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

Programming position of MessageBox

bearoflittlebrain_ol
805 Views
Does anyone know how to program the position of MessageBox to be elsewhere than right in the middle of the screen or Window? Or is it not possible? I know that I can always write my own version of MessageBox, but I would rather not.
Alan
0 Kudos
4 Replies
Steven_L_Intel1
Employee
805 Views
Create an invisible window centered where you want and pass its handle as the HWND to MessageBox?
0 Kudos
bearoflittlebrain_ol
805 Views
Thanks Steve,
Your suggestion will cover most cases, but because I don't know the size of the displayed Messagebox, I will have to keep it a safe distance from the edges.
Alan
0 Kudos
bearoflittlebrain_ol
805 Views
My bug has struck again, and once more I cannot post messages to the Forum. This one is kindly posted by the support staff.

With helpful leads from Paul Curtis, I have developed a function MessageBoxH that uses the same arguments as MessageBox, but with an optional extra Postion argument. It calls MessageBox and if the Position argument is present, uses a Hook Procedure to reposition the dialogue box.

If anyone would like the source code, ask me at
alan.cruttenden@lineone.net

Alan
0 Kudos
dboggs
New Contributor I
805 Views
Does this really work? I tried this in a Quickwin application, along the following lines:

Open a child window to unit X
Locate the window and size it using SETWSIZEQQ
hWnd = GETHWNDQQ (X)
IRETURN = MESSAGEBOX (hWnd, 'Message'C, 'Caption'C, MB_OK)

(This messagebox function is the same as Quickwin MESSAGEBOXQQ except that it takes the additional argument hWnd)

The message box works fine, but no matter what it pops up in the middle of the screen.
0 Kudos
Reply