Check whether your application is running: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
Line 3: Line 3:
== Description ==
== Description ==
This example detects if the application you are uninstalling is running at the start of the uninstallation process.
This example detects if the application you are uninstalling is running at the start of the uninstallation process.
<br>The easiest way to find the "WindowClassOfYourApplication" and "WindowTitleOfYourApplication" is to use Microsoft Spy++. Spy++ is a tool that comes with Visual Studio.
<br>The easiest way to find the "WindowClassOfYourApplication" and "WindowTitleOfYourApplication" is to use Microsoft Spy++. Spy++ is a tool that comes with Visual Studio. You can also use the freeware tool SysTree++ to find the WindowClass.


== The Example Script ==
== The Example Script ==

Revision as of 14:40, 1 December 2008

Author: saabz_500 (talk, contrib)


Description

This example detects if the application you are uninstalling is running at the start of the uninstallation process.
The easiest way to find the "WindowClassOfYourApplication" and "WindowTitleOfYourApplication" is to use Microsoft Spy++. Spy++ is a tool that comes with Visual Studio. You can also use the freeware tool SysTree++ to find the WindowClass.

The Example Script

/* Replace the values of the two defines below to your application's window class and window title, respectivelly. */
!define WNDCLASS "WindowClassOfYourApplication"
!define WNDTITLE "WindowTitleOfYourApplication"
 
Function un.onInit
  FindWindow $0 "${WNDCLASS}" "${WNDTITLE}"
  StrCmp $0 0 continueInstall
    MessageBox MB_ICONSTOP|MB_OK "The application you are trying to remove is running. Close it and try again."
    Abort
  continueInstall:
FunctionEnd

For any queries mail me at :saabz_500@yahoo.co.uk