As a sort of introductory app to windows applications in C++, I've written a short program that displays a few messageboxes, and plays around with the buttons in them (OK, OKCANCEL, etc).
It works beautifully in Windows 2000. However, it silently fails (i.e. no error messages) in XP and I'm not sure why that is. I use both OSes, so I want to be able to run the app in both of them.
Here's the important part of the code: (I've removed a few things from the code, but trust me I didn't omit anything pertinent)
Code:
//sorry for the immature variable/window naming :P
#include <windows.h>
int WINAPI
WinMain(HINSTANCE hInst,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
int lol = MessageBox (NULL, "This is a message box",
"OMG", MB_OKCANCEL);
if (lol == 2) //if user clicked cancel
return 0;
MessageBox (NULL, "Why did you select cancel?",
"ERROR", 0 + 48);
return 0;
}
Is there something in that code that's win2k specific? Is it to do with the OS it was compiled on? Ideally I'd like some code that runs the same on both OSes, but if I have to, I'll settle with compiling a seperate version for each.
Any help is appreciated!
-Rippy