Shoutbox

Modal Windows - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: Modal Windows (/showthread.php?tid=79119)

Modal Windows by Dempsey on 11-17-2007 at 07:30 PM

Is it possible to open a modal window in front of an existing window?

Eg I have my prefs window and the I open a smaller window.

I use EnableWindow to disable the main prefs window, but If I then switch to another program and then select the window in the taskbar, I just see the disabled Prefs window which i can't obviously do anything with, and as the other window is small it's hidden behind it.

How can I do it like for example the plus prefs do it when downloading script documentation etc, which keeps the mini-window on top even when switching to another program and back again.

Thanks for any ideas :)


RE: Modal Windows by Deco on 11-17-2007 at 09:29 PM

Catch the API message that brings the main window back to front?

I'm not sure if it's a creatwindow message or bring to front.. but I'm sure you can do this with API calls..

But then again I bet Cookie could give you a certain answer :P


RE: Modal Windows by vikke on 11-17-2007 at 09:57 PM

Try using the SetParent API to set the small window a child of your Preferences-window. The small window will now be inside the small window, so it will only appear when the actual window appears. You might need to set the TOP_MOST attribute on the window, so it doesn't hide behind various controls, use the SetWindowPos API.
I haven't tried this, but it should work, give it a shot!

This isn't the Win32 way to do it, but this is pretty easy, and it's available for scripting.


RE: Modal Windows by markee on 11-18-2007 at 10:04 AM

It would be nice if we had the opportunity to have pop-up windows as well as the dialog and child types.  I was looking into this a while ago and a childwindow doesnt work exactly how you want.  You can always use a timer to check for the forground window and if it matches the one you wanted then you can just use the user32 function to forground the window you wanted infront.


RE: Modal Windows by Patchou on 11-18-2007 at 11:17 PM

what you need to do is modal windows and currently, scripts are only allowed to do modeless. That's a technical limitation designed to prevent stack overflows and other similar problems. Plus! rarely uses modal windows (although, in the case of the "downloading..." window, yes, it is one).

A workaround is to intercept WM_ACTIVATE in the parent and automatically set the child in the foreground when it's displayed.