// IsMyAppRunning.cpp : Defines the entry point for the DLL application. // This DLL is called from an InstallShield install as an Express Extension #include "stdafx.h" BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { return TRUE; } CHAR WINAPI ISMyAppRunning( HWND hwnd, LPSTR szSrcDir, LPSTR szSupport, LPSTR szInst, LPSTR szRes ) { HANDLE hFile; char szTmp[1024]; char szExe[1024]; wsprintf(szExe, "%s\\%s", szInst, "MyApp.EXE"); hFile = CreateFile(szExe, // file to create GENERIC_WRITE, // open for writing 0, // do not share NULL, // default security OPEN_EXISTING, // Opens the file. Fails if the file does not exist FILE_ATTRIBUTE_NORMAL | // normal file FILE_FLAG_OVERLAPPED, // asynchronous I/O NULL); // no attr. template if (hFile == INVALID_HANDLE_VALUE) { wsprintf(szTmp, "MyApp appears to be running. Close all instances of MyApp and try again."); MessageBox(GetFocus(), szTmp, "MyApp Upgrade failed", MB_OK); return (0); } else { CloseHandle(hFile); return (1); } }Basically, it attempts to create a file with the same name as my exe. If it can, I can go ahead with the upgrade. If not, I know the exe is in use.