Go Back   Winamp & SHOUTcast Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 14th August 2018, 22:14   #1
r2du-soft
Senior Member
 
r2du-soft's Avatar
 
Join Date: Nov 2013
Location: Iran
Posts: 272
Question Get Windows ClassName and TitleName With Application Process.exe Name

Get Windows ClassName and TitleName With Application Process.exe Name

Suppose we do not know the ClassName or TitleName for the notepad.exe
for now we use from the other apps (for sample autoit) for find the applications ClassName and TitleName...

this code give me ClassName and TitleName but just show class and title the windows focused on that!

HTML Code:
Section

Loop:

Sleep 555 
System::Call user32::GetForegroundWindow()i.r1 
System::Call 'USER32::GetClassName(ir1,t.r2,i ${NSIS_MAX_STRLEN})' 
System::Call 'USER32::GetWindowText(ir1,t.r3,i ${NSIS_MAX_STRLEN})' 


SetDetailsPrint both
DetailPrint "($1)($2)($3)"
SetDetailsPrint none


Goto Loop


SectionEnd

now i try all ways to do it,but i failed
for sample i try this:

HTML Code:
System::Call user32::GetForegroundWindow(notepad.exe)i.r1 
System::Call 'USER32::GetClassName(ir1,t.r2,i ${NSIS_MAX_STRLEN})' 
System::Call 'USER32::GetWindowText(ir1,t.r3,i ${NSIS_MAX_STRLEN})' 
but i o access to ClassName and TitleName notepad.exe
r2du-soft is offline   Reply With Quote
Old 14th August 2018, 23:55   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,927
GetForegroundWindow only gets the window the user is working in, you cannot pass a module name to it.

Call user32::EnumWindows to enumerate all top-level windows on the desktop.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 19th August 2018, 23:57   #3
r2du-soft
Senior Member
 
r2du-soft's Avatar
 
Join Date: Nov 2013
Location: Iran
Posts: 272
Quote:
Originally Posted by Anders View Post
GetForegroundWindow only gets the window the user is working in, you cannot pass a module name to it.

Call user32::EnumWindows to enumerate all top-level windows on the desktop.
thanks Anders

HTML Code:
!include LogicLib.nsh
showinstdetails show

Section

System::Get "(i.r1) iss"
Pop $R0
System::Call "user32::EnumWindows(k R0,i) i.s"
loop:
    Pop $0
    StrCmp $0 "callback1" 0 done
    ;System::Call "user32::IsWindowVisible(ir1)i.r2"
    ;${If} $2 <> 0
        System::Call "user32::GetWindowText(ir1,t.r2,i ${NSIS_MAX_STRLEN})"
        System::Call "user32::GetClassName(ir1,t.r3,i ${NSIS_MAX_STRLEN})"
		System::Call "user32::GetWindowModuleFileName(ir1,t.r4,i ${NSIS_MAX_STRLEN})"
		System::Call "user32::GetWindowThreadProcessId(ir1,*i.r5)" 
		;-----------------------------
		DetailPrint "____________________________________"
		DetailPrint "callback1!: [$0]"
		DetailPrint "Num: [$1]"
		DetailPrint "Class Name: [$2]"
		DetailPrint "Title Name: [$3]"
		DetailPrint "ModuleFileName: [$4]"
		DetailPrint "Pid Number: [$5]"
		DetailPrint "x2: [$6]"
		DetailPrint "____________________________________"
		Push 1 # callback's return value
		System::Call "$R0"
		Pop $0
	;${EndIf}
Goto loop
  done:
  System::Free $R0
;Dumpstate::Debug


SectionEnd
r2du-soft is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump