Nothing appears. But I do hear the standard Windows-sound. And if I add " | MB_ICONEXCLAMATION" I hear the sound of the exclamation-messagebox, but the damn thing keeps invisible.
I inserted the same MessageBox call in a new Win32 GUI project (from the WindowsApp template) and it worked fine.
I've got the program and the executable, compiled with MS Visual C++. If I execute the binary the messagebox is visible, but when I compile with Dev-Cpp nothing happens, except for that beep.
Are there some wndclass settings I have to change? Can anyone help me?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Perhaps the parent window is invalid or is invisible as well. Are you sure the window is already visible at the time you call MessageBox?
Try setting the HWND parameter (the first parameter) to NULL and see if that works. If that works, set the parameter back to the child window, and try to fix it correctly.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ok, the example someone gave and said 'should work like that..', won't work like that (hwnd is never declared). Joey is probably right, MessageBox is a pretty simple function, generally if it's not working it's because you're giving it a bad window handle. This code should run (does here):
include <windows.h>
int WINAPI WinMain (HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
int nFunsterStil)
{
MessageBox((HWND)NULL, "Boo!", ";-)",0);
return 0;
}
try changing the handle in your code to (HWND)NULL and see if it works, if it does you have to figure out what's wrong with the handle you're using. If you still need help post your compile log, and your code if it's short enough.
b_a
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
No siema, szukałem ostatnio porządnego asortymentu z dostawą do domu i trafiłem na sklep alkoholowy internetowy https://finespirits.pl/pl/ po tym, jak znajomy polecił mi to miejsce w rozmowie. Najpierw ostro się namęczyłem, bo w okolicy nic nie było, a lokalne sklepy miały strasznie ubogi wybór. W końcu zaryzykowałem, zamówiłem kilka butelek przez sieć i wszystko dotarło bezpiecznie w ekspresowym tempie. Całkowicie ułatwiło mi to przygotowania do weekendu. Jak ktoś szuka czegoś konkretnego bez wychodzenia z domu, to obczajcie ten temat.
Last edit: Daniel Matetew 2026-09-14
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I call MessageBox (MessageBoxW) like this:
MessageBox(hWindow, "BOO!", ":-)", MB_OK);
Nothing appears. But I do hear the standard Windows-sound. And if I add " | MB_ICONEXCLAMATION" I hear the sound of the exclamation-messagebox, but the damn thing keeps invisible.
I inserted the same MessageBox call in a new Win32 GUI project (from the WindowsApp template) and it worked fine.
I've got the program and the executable, compiled with MS Visual C++. If I execute the binary the messagebox is visible, but when I compile with Dev-Cpp nothing happens, except for that beep.
Are there some wndclass settings I have to change? Can anyone help me?
Maybe if you made it:
MessageBox(GetActiveWindow(), "Boo!", ":-)", MB_OK | MB_TOPMOST);
that works on mine. (I used messageboxer for this!)
include <windows.h>
int WINAPI WinMain (HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
int nFunsterStil)
{
MessageBox(hwnd, "Boo!", ";-)",0);
return 0;
}
should work like that.....
In my program it doesn't. Even MB_SYSTEMMODAL doesn't work!
Isn't there anybody who knows the answer?
Maybe I should post my basic 2 (it compiles fine)
Perhaps the parent window is invalid or is invisible as well. Are you sure the window is already visible at the time you call MessageBox?
Try setting the HWND parameter (the first parameter) to NULL and see if that works. If that works, set the parameter back to the child window, and try to fix it correctly.
Have you tried MB_TOPMOST ?
-- Jim.
It is visible. But thank you for your help. I am going to try that.
Oy vey......
Ok, the example someone gave and said 'should work like that..', won't work like that (hwnd is never declared). Joey is probably right, MessageBox is a pretty simple function, generally if it's not working it's because you're giving it a bad window handle. This code should run (does here):
include <windows.h>
int WINAPI WinMain (HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
int nFunsterStil)
{
MessageBox((HWND)NULL, "Boo!", ";-)",0);
return 0;
}
try changing the handle in your code to (HWND)NULL and see if it works, if it does you have to figure out what's wrong with the handle you're using. If you still need help post your compile log, and your code if it's short enough.
b_a
Hey guys, instead hwnd or HWND or whatever just put a 0 in
MessageBox(0, "Boo!", ";-)",0);
No siema, szukałem ostatnio porządnego asortymentu z dostawą do domu i trafiłem na sklep alkoholowy internetowy https://finespirits.pl/pl/ po tym, jak znajomy polecił mi to miejsce w rozmowie. Najpierw ostro się namęczyłem, bo w okolicy nic nie było, a lokalne sklepy miały strasznie ubogi wybór. W końcu zaryzykowałem, zamówiłem kilka butelek przez sieć i wszystko dotarło bezpiecznie w ekspresowym tempie. Całkowicie ułatwiło mi to przygotowania do weekendu. Jak ktoś szuka czegoś konkretnego bez wychodzenia z domu, to obczajcie ten temat.
Last edit: Daniel Matetew 2026-09-14