Greetings,
my application already creates a mutex object to prevent multiple instances of it from running.
How do i access this mutex object from installscript such that i can detect that my application is running before uninstalling?
regards
Varun
Greetings,
my application already creates a mutex object to prevent multiple instances of it from running.
How do i access this mutex object from installscript such that i can detect that my application is running before uninstalling?
regards
Varun
I haven't tried it, but perhaps see if you can you prototype and call the OpenMutex API function exported from Kernel32.dll?
Robert Dickau - This and That - Flexera Software
Want help? See Windows Installer white papers, training courses, newsletters, HelpNet, forum search, Knowledge Base, ...
Want more help? See our InstallTalk blog.
Want even more help? See our relatively new Advanced Windows Installer (MSI) training course.
I did a Mutex implementation years ago when my application framework developer decided that he didn't llike using hidden windows and FindWindow() anymore. We implemented it in both directions though. When either the install or the application started it checked for a mutex and either terminated or created one. That way no one could try to start the application while the install was in progress.
Unfortunatly I don't have the source code anymore.
Here is a forum post from InstallSite in German. There is some source code, but I don't know if it works.
http://forum.installsite.net/index.p...=0&#entry29650
BTW you could also use WBEM to query the win32_process table to see if your app is running.
Last edited by Christopher Painter; 10-14-2005 at 09:24 PM.
As a rough sketch, this seems to work (looking for the mutex created by a Windows Installer installation in deferred mode):Code:prototype HWND kernel32.OpenMutexA(NUMBER, BOOL, BYVAL STRING); function OnBegin( ) HWND hMutex; begin hMutex = OpenMutexA(READ_CONTROL, FALSE, "_MSIExecute"); /* // for debugging SprintfBox(INFORMATION, "hMutex", "hMutex: %d\nGetLastError: %s", hMutex, FormatMessage(Err.LastDllError)); */ if (hMutex) then MessageBox("Found the mutex...", INFORMATION); CloseHandle(hMutex); else MessageBox("Didn't find it...", INFORMATION); endif; end;
Robert Dickau - This and That - Flexera Software
Want help? See Windows Installer white papers, training courses, newsletters, HelpNet, forum search, Knowledge Base, ...
Want more help? See our InstallTalk blog.
Want even more help? See our relatively new Advanced Windows Installer (MSI) training course.
Thank u for your replies...
I tried them, but somehow i couldn't find the mutex of the Running application through InstallScript(..i think there was some conflict with the mutex name).
However i found a solution...
I used the same function that my application uses... this function prevents multiple instances of my application from running.
i embedded this function in a DLL.. and called this DLL from InstallScript..
This works fine...
Thanx again for ur help
regards,
Varun