I don't even think that APIs are going to help you.
Just off the cuff I thought of two approaches:
1. Get the message box window, and change its location
2. Change the screen size, present the messagebox so that it centers itself, then quickly resize the screen so that that center point is no longer at the center. (This would be a ridiculous way to do things; it's only that it crossed my mind.)
But both of these suffer from the same flaw: you can take no action until that box is closed...
There might be some way I am unfamiliar with, but this is the situation I'm aware of.
You could create your own message box by creating a form that is controlled by a function of your own writing that completely emulates the behavior of a message box, but that takes additional parameters for location and or size. I have seen this suggested to create a message box that writes all message-box calls to a log file. Perhaps looking online along that idea will turn up something useful.
You could make it establish its width based on the content or have a preset width that causes the message to word-wrap. You could have the form's background color something more red for warnings, and so on. (You could even incorporate one or more timers to incorporate flashing of text or icons, or to scroll the message marquee-like, etc.)
All of these capabilities would be controlled by arguments given (optional arguments or an overloaded display method). You would have to write the code to accomplish these, but the point is that you can make a really robust message-box-like capability.
You could have more button possibilities (Yes, No, Cancel, Retry, Abort, Close, Send Report, Donât Know, or anything else you can think up), or you could have the ability to set the button-face text and the button count along with the message and the form's title.
Wrap all this into a class, and you can instantiate it and call its methods, or make it static, and call the methods from anywhere.
|