|
|
(5 intermediate revisions by 2 users not shown) |
Line 1: |
Line 1: |
| == Description ==
| | #REDIRECT [[Close/exit a program]] |
| | |
| Detect if an application is running and close it. Requires a valid Windows Class Name, which can be detected with tools like [http://www.gena01.com/win32spy/ Win32Spy].
| |
| | |
| == Function Code ==
| |
| | |
| <highlight-nsis>
| |
| Function CloseWindow
| |
| Push $0
| |
| loop:
| |
| FindWindow $0 "MyWindow" ;insert Windows Class Name
| |
| IntCmp $0 0 done
| |
| SendMessage $0 16 0 0
| |
| Sleep 100
| |
| Goto loop
| |
| done:
| |
| Pop $0
| |
| FunctionEnd
| |
| </highlight-nsis>
| |
| | |
| == Examples ==
| |
| | |
| To detect and close Winamp (1.x, 2.x, 5.x) use the following script.
| |
| | |
| <highlight-nsis>
| |
| Function CloseWinamp
| |
| Push $0
| |
| loop:
| |
| FindWindow $0 "Winamp v1.x"
| |
| IntCmp $0 0 done
| |
| SendMessage $0 16 0 0
| |
| Sleep 100
| |
| Goto loop
| |
| done:
| |
| Pop $0
| |
| FunctionEnd
| |
| </highlight-nsis>
| |
| | |
| To close Winamp 3.x, use
| |
| <highlight-nsis>
| |
| FindWindow $0 "STUDIO"
| |
| </highlight-nsis>
| |
| | |
| Page author: [[User:Jan|Jan]]
| |