Jump to content

Messagebox

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
7 replies to this topic

#1
smash_point

smash_point

    Newbie

  • Members
  • Pip
  • 2 posts
Hi, I wrote a program a while ago. It's very simple

#include <stdio.h>

void display_line(void);

main()
{
      display_line();
      printf( "\n Hello\n" );
      display_line();
      
      return 0;
}

/* print asterisk line */
void display_line(void)
{
     int counter;
     
     for( counter = 0; counter < 9; counter++ )
         printf( "*" );
}
/* End of Program */

It basically just prints Hello with a top and bottom * boreder line. I wanted to do that on a messagebox but didnt know how to store the whole thing border and all maybe in some kind of pointer so I could have it shown on my messagebox like MessageBox(0, pointer, Title, MB_OK);
I'm starting to learn win32 API now and could use the help. Appreciate it.

Edited by Jaan, 11 August 2008 - 12:54 AM.
Please use CODE tags when you're posting your codes!


#2
MeTh0Dz

MeTh0Dz

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,119 posts
First off you need to give main a type...

If you want to use a pointer you can do it like this...

#include <windows.h>

int main() {
    char * display_data;
    display_data = (char*)malloc(sizeof(char) * 30);
    
    display_data = "**********\n Hello\n**********";
    MessageBox(0, display_data, "HI", MB_OK);
    
    free(display_data);
    
    return 0;
}


#3
dargueta

dargueta

    Writes binary right handed and hex left handed

  • Moderators
  • 4,720 posts
Why would you want to use asterisks when you can use the messagebox? Are you talking about a console message box, like this one?

#4
MeTh0Dz

MeTh0Dz

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,119 posts
I just ported over what he did. He can take out the asterisks if he doesn't want them.

#5
dargueta

dargueta

    Writes binary right handed and hex left handed

  • Moderators
  • 4,720 posts
That was directed at smash_point, since he mentioned wanting to put a border:

Quote

[...] I wanted to do that on a messagebox but didnt know how to store the whole thing border [...]


#6
MeTh0Dz

MeTh0Dz

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,119 posts
Oh alright.

#7
v0id

v0id

    Retired

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,936 posts
I think he wants what MeTh0Dz did: to have a border of asterisks inside the messagebox.

If however you, smash_point, did look for something like in the link dargueta posted, then I suggest you a library called ncurses.

#8
smash_point

smash_point

    Newbie

  • Members
  • Pip
  • 2 posts
Thanks for the help. What I wanted to do was generate multiple asterix to use for my border. I was trying to understand what were the capabilities of the messagebox. If it was similar to printf in that you could us it along with the
for( counter = 0; counter < 9; counter++ )

or something similar to generate a chain of asterix without having to type them in. I'll check out the ncurses also. Thanks