Posts: 102
Threads: 30
Joined: Mar 2018
12-29-2018, 05:49 PM
(This post was last modified: 12-29-2018, 05:52 PM by InterestedNewbie.)
Is it possible with the QM Windows, Controls function to open an application, let's say Notepad, keeping it on top and more importantly: force focus (blinking cursor) on it so that the user cannot activate underlying applications until Notepad has closed?
I've tried about every On Top, Focus, Z-order, If..option in the QM menu but I haven't been able to accomplish this yet....
Posts: 12,140
Threads: 142
Joined: Dec 2002
Not easily. Not reliably. Would need keyboard and mouse hooks to not allow to click other windows and press Alt+Tab, Win, etc. Also activate window in loop. Cannot disable Ctrl+Alt+Delete.
Posts: 1,338
Threads: 61
Joined: Jul 2006
12-29-2018, 09:37 PM
(This post was last modified: 12-29-2018, 09:47 PM by Kevin.)
maybe something like this
It's not perfect but will keep notepad active
Function
NotepadExample
int w
run "$system$\notepad.exe" "" "" "" 0x800 win("" "Notepad") w
Zorder w HWND_TOPMOST
rep
,0.2
,if(!IsWindow(w)) ret
,if win()!=w
,,act w
,,err
,,,if(!IsWindow(w)) ret
Posts: 102
Threads: 30
Joined: Mar 2018
Great work Kevin! Works perfectly with Notepad. However, if I replace it with another application, like in this case a simple text input dialog made with QM, it doesn't work. Does it have to do with one of the flags?
int w
run "$program files$\Test\Test Application.exe" "" "" "" 0x800 win("" "Test Application") w
Zorder w HWND_TOPMOST
rep
,0.2
,if(!IsWindow(w)) ret
,if win()!=w
,,act w
,,err
,,,if(!IsWindow(w)) ret
Posts: 1,338
Threads: 61
Joined: Jul 2006
It doesn't work because this line is incorrect
win("""Test Application")
The first set of quotes is for window name the second is for window class.
Posts: 102
Threads: 30
Joined: Mar 2018
12-30-2018, 01:40 AM
(This post was last modified: 12-30-2018, 01:48 AM by InterestedNewbie.)
Thanks, had already figured it out by going through the Files, web menu ;-)
int w
run "$program files$\Test\Test Application.exe" "" "" "" 0x800 win("Test Application" "#32770") w
Zorder w HWND_TOPMOST
rep
,0.2
,if(!IsWindow(w)) ret
,if win()!=w
,,act w
,,err
,,,if(!IsWindow(w)) ret