MessageBox Win32 API Part 2

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
3,685
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Nov 16, 2008

EDIT : If Visual Studio says something like "hWnd is being used without being initialized", remove it's declaration and at MessageBox call use NULL as the first parameter. Example : MessageBox(NULL, //The rest of the stuff). Or you could use HWND_DESKTOP and the message box's owner would be the desktop.

Here's the link to Code::Blocks, the IDE used : http://downloads.sourceforge.net/codeblocks/codeblocks-8.02mingw-setup.exe .
As I've said earlier the MessageBox takes the following parameters : HWND owner, text, caption and unsigned int's determining the buttons and the icon. Since we declared an HWND variable we can use it as HWND owner. The replacements for MB_ICONERROR are MB_ICONHAND and MB_ICONSTOP.
Same applies to the warning box except that we use MB_ICONWARNING or MB_ICONEXCLAMATION.
If you don't know what a function or a return value is please refer to a C book. Based on what button the user presses the MessageBox function returns IDOK or IDNO.
Here's a list with all the MessageBox icons buttons and return values : http://msdn.microsoft.com/en-us/library/ms645505(VS.85).aspx .

Link to this comment:

Share to:

Uploader Comments (Win32APICProgrammer)

  • Everybody, please read the description and especially the EDIT !

  • GREAT! I'm looking forward to watching your tutorials...

    I'm using VC++ Express 2008. I got some problems in my vista, so i lost many system files. I will re-install my Vista as well as VC++ Express 2008...

  • Right now, I'm using Vista Ultimate x32, and I don't even get to boot up, cuz Avira starts saying that EXCEL.exe is virused and something about temp files, ZOMFG !

  • THANKS...

  • On my 3rd tutorial I'll show how to clear the screen in command line using Win32API and how to make your own "dir"; it enumerates all the files or folders in a folder. So, we're going to do some console stuff too, but it's still Win32API. Out of curiosity, what IDE are you using ? Cuz, I'd seriously recommend Visual C++ 2008 (the Express edition).

see all

All Comments (4)

Sign In or Sign Up now to post a comment!
  • i dont know why you dont continue doing tutorials about winapic++

  • THANKS.. gracias wey me sirvio de mucho sigue haciendo mas please

    keep you doing more tutorials about winapi c++ please xD

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more