[OT] MessageBox startup display location

Hi,

this is OT but maybe someone asked herself/himself the same question: Every developer, even driver developers e.g for installers, helpers, notifications etc. will use a MessageBox someday. I always wonder why Microsoft Runtime/API Developers NEVER published a MessageBox function that allows to be manually placed somewhere on the screen with user defined coordinates. Under some situations i wanted to display a MessageBox at some predefined location or on a particular screen on multiscreen systems or inside some Window somewhere. Since there is no explicit function parameters, not even in the MessageBoxIndirect function, i always had to go the way to set a hook with SetWindowsHookEx inside the application of type WH_CBT and watch for HCBT_ACTIVATE and then catch the window handle and do some calculations and/or modifications on the dialog and finally place it with SetWindowPos wherever i wanted it to be placed. I wrote a pretty nice framework that makes that really easy for me, but it would be much easier if someday a MessageBox function would be available, that can be feed with startup location parameters so i can skip this hook stuff.

best

K.

C’mon… Putting OT in the topic doesn’t make this a good topic here. Please.

Peter
OSR

I believe a MessageBox is displayed centered on its parent window. If you
specify NULL as the parent, you are already in trouble, for a variety of
reasons so far OT that I’m not going to go into them here. The result of
the center-on-parent is that the MesageBox should cone up where the user
is looking, and this handles the multiple-monitor case automatically. So
the reason you can’t set the location is that are not expected to need to.
joe

Hi,

this is OT but maybe someone asked herself/himself the same question:
Every developer, even driver developers e.g for installers, helpers,
notifications etc. will use a MessageBox someday. I always wonder why
Microsoft Runtime/API Developers NEVER published a MessageBox function
that allows to be manually placed somewhere on the screen with user
defined coordinates. Under some situations i wanted to display a
MessageBox at some predefined location or on a particular screen on
multiscreen systems or inside some Window somewhere. Since there is no
explicit function parameters, not even in the MessageBoxIndirect function,
i always had to go the way to set a hook with SetWindowsHookEx inside the
application of type WH_CBT and watch for HCBT_ACTIVATE and then catch the
window handle and do some calculations and/or modifications on the dialog
and finally place it with SetWindowPos wherever i wanted it to be placed.
I wrote a pretty nice framework that makes that really easy for me, but it
would be much easier if someday a MessageBox function would be available,
that can be feed with startup location parameters so i can skip this hook
stuff.

best

K.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

http://support.microsoft.com/kb/180936

On 12/20/12, xxxxx@flounder.com wrote:
> I believe a MessageBox is displayed centered on its parent window. If you
> specify NULL as the parent, you are already in trouble, for a variety of
> reasons so far OT that I’m not going to go into them here. The result of
> the center-on-parent is that the MesageBox should cone up where the user
> is looking, and this handles the multiple-monitor case automatically. So
> the reason you can’t set the location is that are not expected to need to.
> joe
>
>> Hi,
>>
>> this is OT but maybe someone asked herself/himself the same question:
>> Every developer, even driver developers e.g for installers, helpers,
>> notifications etc. will use a MessageBox someday. I always wonder why
>> Microsoft Runtime/API Developers NEVER published a MessageBox function
>> that allows to be manually placed somewhere on the screen with user
>> defined coordinates. Under some situations i wanted to display a
>> MessageBox at some predefined location or on a particular screen on
>> multiscreen systems or inside some Window somewhere. Since there is no
>> explicit function parameters, not even in the MessageBoxIndirect
>> function,
>> i always had to go the way to set a hook with SetWindowsHookEx inside the
>> application of type WH_CBT and watch for HCBT_ACTIVATE and then catch the
>> window handle and do some calculations and/or modifications on the dialog
>> and finally place it with SetWindowPos wherever i wanted it to be placed.
>> I wrote a pretty nice framework that makes that really easy for me, but
>> it
>> would be much easier if someday a MessageBox function would be available,
>> that can be feed with startup location parameters so i can skip this hook
>> stuff.
>>
>> best
>>
>> K.
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>>
>
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>