Click here to Skip to main content
15,886,830 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello, how can i set messagebox position ?

I know how to create MessageBox and set randomize position when someone click on a button , but i want to know how can i set *spawn* position ?

What I have tried:

I haven't tried anything yet, please help me solve my problem.
Posted
Updated 6-Nov-19 6:00am
Comments
Richard MacCutchan 6-Nov-19 11:13am    
What is "*spawn* position"?
[no name] 6-Nov-19 11:40am    
I mean random position in the screen
Richard MacCutchan 6-Nov-19 11:48am    
You will need to create your own dialog that does what a MessageBox does. You can then call MoveWindow to change its position on the screen.

You could probably do it by using a TaskDialogIndirect function (commctrl.h) - Win32 apps | Microsoft Docs[^]. This function gives you access to the HWND of the dialog, and thus the ability to move it about the screen.
 
Share this answer
 
Quote:
ut i want to know how can i set *spawn* position ?
Do you mean 'without the user action?' you might use a timer for that.

[update]
Quote:
I mean random position in screen
As Richard suggested, you cannot do that with the standard Windows MessageBox. Have a look at this CodeProject article: XMessageBox - A reverse-engineered MessageBox()[^]
[/update]
 
Share this answer
 
v3
Comments
[no name] 6-Nov-19 11:40am    
I mean random position in screen
CPallini 6-Nov-19 12:06pm    
Have a look at Hans Dietrich's article (see my updated solution).

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900