How to detect if an executable is running before installing? - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

vermefr
Posts: 10
Joined: Thu Jul 26, 2007 2:57 pm

How to detect if an executable is running before installing?

Hello,

I am trying to detect if an executable (belonging to the installed package) is running before continuing the re-installation / uninstallation process.
Indeed, I'd like to prevent the re-installation / uninstallation if the application is still running.

I have tried the ErrorMessage feature but as far as I know, it's not possible to make a condition based on the returned value of a function in a DLL or again a custom exe (which would test the running state of my application).

Any solution ??
Many thanks in advance.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,

This is already a feature of Windows Installer. During a re-installation or uninstall, if an application which will be reinstalled (or uninstalled) is running, Windows Installer will automatically launch the "Files in use" dialog which will allow you to close the application.

However, if you want to close the application before the uninstall begins you can use a custom action.

Regards,
cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
vermefr
Posts: 10
Joined: Thu Jul 26, 2007 2:57 pm

Thanks for your answer cosmin.
Yes, I saw that Windows Installer shows a dialog when my application's WINDOW is open, but NOT in the case where this window is closed while my application is still running in the background.
So, the default behaviour of Windows Installer is not sufficient in my particular case...

That's why I have to make my own application running detection.

Can you help me ?
THX !
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,

You can create a custom action .dll which will detect if the application is running. We have an example of a .dll custom action, please take a look: http://www.advancedinstaller.com/user-g ... n-dll.html
You need to modify this .dll in order to use it for what you need.

I'm afraid I don't have an example for detecting if an application is running.

Regards,
cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
vermefr
Posts: 10
Joined: Thu Jul 26, 2007 2:57 pm

Yes, it's OK now, thanks to your 'serial number validation' DLL example.

Many thanks again !

Return to “Common Problems”