Skip to content
⌘ NSIS Forum Archive

Find Window with Partial Name

4 posts

Wabiloo#

Find Window with Partial Name

Hi!

Is there any way of finding a window when only knowing part of its title?
Eg. I have a window called "Microsoft Word - This Document - Bla". I'd like to find that window, only knowing part of that title, ie. "Microsoft Word"

Otherwise, is there any way in NSIS to enumerate the open windows?
CancerFace#
From the System Plugin readme:
SetPluginUnload alwaysoff
System::Get "(i.r1, i) iss"
Pop $R0
System::Call "user32::EnumChildWindows(i $HWNDPARENT, k R0, i) i.s"
loop:
Pop $0
StrCmp $0 "callback1" 0 done
System::Call "user32::GetWindowText(ir1,t.r2,i${NSIS_MAX_STRLEN})"
System::Call "user32::GetClassName(ir1,t.r3,i${NSIS_MAX_STRLEN})"
IntFmt $1 "0x%X" $1
DetailPrint "$1 - [$3] $2"
Push 1 # callback's return value
System::Call "$R0"
Goto loop
done:
SetPluginUnload manual
System::Free $R0
More info on EnumWindows .
Try also FindWindowEx.

I am not sure if the internal NSIS FindWindow command achieves what you are after ...

CF
Takhir#
FindCloseTerminate not returnes handle, but can find by name part and close or terminate (with optional MessageBox popup).
r2du-soft#
hi

This code return nsis installer EnumChildWindows:


SetPluginUnload alwaysoff
System::Get "(i.r1, i) iss"
Pop $R0

System::Call "user32::EnumChildWindows(i $HWNDPARENT, k R0, i) i.s"
loop:
        Pop $0
        StrCmp $0 "callback1" 0 done
        System::Call "user32::GetWindowText(ir1,t.r2,i${NSIS_MAX_STRLEN})"
        System::Call "user32::GetClassName(ir1,t.r3,i${NSIS_MAX_STRLEN})"
        IntFmt $1 "0x%X" $1
        DetailPrint "$1 - [$3] $2"
        Push 1 # callback's return value
        System::Call "$R0"
        Goto loop
done:
SetPluginUnload manual
System::Free $R0

i change code for set that in calculator but i cant run that...
how can change this code for calculator EnumChildWindows?
thanks