Reply To: Minimize MEW when running a macro?

Product Compare Forums Multi-Edit Support Minimize MEW when running a macro? Reply To: Minimize MEW when running a macro?

#4449
deleyd
Participant

is it possible to get a handle to the Multi-Edit window from within Multi-Edit? (I’m pretty sure it can be done, I just don’t know how. I hope someone will tell us how.)

Microsoft has a CloseWindow function which I haven’t tried but the description is, “The CloseWindow function minimizes (but does not destroy) the specified window.

It however requires a handle to the window to be minimized, so the question now is how do we get the handle we need? (I hope someone will tell us how.)

CloseWindow is documented at:
[url:2eq0s0wc]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/Windowing/Windows/WindowReference/WindowFunctions/CloseWindow.asp[/url:2eq0s0wc]

Examples of calling Microsoft library routines is at:
[url:2eq0s0wc]http://www.multiedit.com/forums/viewtopic.php?t=405[/url:2eq0s0wc]

You would add to the top an ‘import’ statement like:
[code:2eq0s0wc]import BOOL CloseWindow(HWND hWnd) user32 ‘CloseWindow’;[/code:2eq0s0wc]

There’s also OpenIcon which looks like it restores a minimized window:
[url:2eq0s0wc]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/Windowing/Windows/WindowReference/WindowFunctions/OpenIcon.asp[/url:2eq0s0wc]

You would add to the top an ‘import’ statement like:
[code:2eq0s0wc]import BOOL OpenIcon(HWND hWnd) user32 ‘OpenIcon’;[/code:2eq0s0wc]

I’ve never tested this or attempted this so I don’t know if this will work. A Multi-Edit macro might not give the Windows Operating System a chance to minimize the window until after the macro exits. I don’t know.