Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

MessageBox

longthong
Beginner
1,275 Views

I want to use MessageBox from a dilog box routine in a win32 application. It seems I need the handle of thedialog box.as an argument of the MessageBox function. How do I get thei handle?

I am a CVF user and am new to this forum. I will now start reading all of the postings. Thanx for any help you can give.

LongThong

0 Kudos
6 Replies
Steven_L_Intel1
Employee
1,275 Views
GetForegroundWindow() will return the handle you want.
0 Kudos
anthonyrichards
New Contributor III
1,275 Views
...or, if you are in a dialog callback rotuine which supplies the DLG as an argument, you could use DLG%hWnd, which is the handle to the dialog box. At a push , you can use NULL as the handle.
0 Kudos
longthong
Beginner
1,275 Views

Yes. NULL works fine.Thank you. But the message box is beneath the main frame window. I have to minimize the main window to see it and respond. I wonder what I am doing wrong?. I never had this problem with QuickWin.

LongThong

0 Kudos
Jugoslav_Dujic
Valued Contributor II
1,275 Views
Well, that means that NULL doesn't work fine Smiley with tongue out [:-P]

Use Dlg%hWnd (preferred) or GetForegroundWindow instead.
0 Kudos
anthonyrichards
New Contributor III
1,275 Views
There are various flags you can combine for use with MessageBox to control how it is displayed. For example MB_SETFOREGROUND (which causes a call to SetForegroundWindow), MB_TOPMOST, MB_SYSMODAL. These flags can be combined with the other flags such as MB_ICONQUESTION, MB_OK using the IOR() finction. e.g. IOR(MB_ICONQUESTION, IOR(MB_SYSMODAL,MB_OK) ).See the Help for MessageBox.
0 Kudos
longthong
Beginner
1,275 Views

I discovered what I was doing wrong. I wasn't handling the WM_PAINT message. When I put some code in the handler everything came out in the correct order. Sorry to have bothered you. NULL workd fine. Thanx again.

LongThong

0 Kudos
Reply