Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Convert window handle to window name/class
#1
Hi, all!
This simple macro toggles active window topmost/normal property, and displays the outcome.
Works just fine, pretty useful for my work...
Macro ToggleActiveWindowZOrder
Trigger W0     Help - how to add the trigger to the macro
 
Code:
Copy      Help
if(GetWinStyle(win 1)&WS_EX_TOPMOST)
,Zorder win HWND_NOTOPMOST
,OnScreenDisplay F"{win} window is set to be a normal window" 1.5 -50 -50 "Calibri" 0 0xFF0000 2 ;;vbBlue;
,
else
,Zorder win HWND_TOPMOST
,OnScreenDisplay F"{win} window is set to be topmost" 1.5 -50 -50 "Calibri" 0 0xFF 2 ;;vbRed;

But...
OnScreenDisplay F"{win}" only shows a window handle, which is not very informative...
How do I convert window handle to the corresponding window name/class?

It took me 2 days to find out that I'm not able to find the answer on my own...

Thanks for your help!!
#2
Type window name into the Find help, functions, tools field, Enter.
#3
Thank you, Gintaras!
Here's the corrected macro, hope this will be helpful for someone:
Macro ToggleActiveWindowZOrder
Trigger W0     Help - how to add the trigger to the macro
Code:
Copy      Help
str functionPrefix
str programName

outw win functionPrefix programName
programName.replacerx("^.*'' " "")

if (GetWinStyle(win 1)&WS_EX_TOPMOST)
,Zorder win HWND_NOTOPMOST
,OnScreenDisplay F"''{programName}'' window: Normal" 1 -50 -50 "Calibri" 0 0xFF0000 2 ;;vbBlue;
else
,Zorder win HWND_TOPMOST
,OnScreenDisplay F"''{programName}'' window: Topmost" 1 -50 -50 "Calibri" 0 0xFF 2 ;;vbRed;

Somehow, I overlooked this Find help, functions, tools field, and never used it, I only used QM help file.
But the help file doesn't list every single QM feature, because there are a lot of inbuilt functions in the System folder, which are not described in the Help.
Still, they all can be found using this search field.

Thank you for this extremely powerful application!


Forum Jump:


Users browsing this thread: 1 Guest(s)