473,323 Members | 1,551 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

Uninstall - Target Still Running?

During an uninstall, how can I check to see if the application I an
uninstalling is currently running?

--
-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
--

Nov 16 '05 #1
24 3671
Hi Thom,

Based on my understanding, you want to un-install an application, so you
want to know whether an application is running before un-install.

================================
You can refer to System.Diagnostics namespace.

You can use Process.GetProcessesByName method to return a list of running
processes, whoes name is your application.

If you can not determine your application's name, I think you may use
Process.GetProcesses method to get all the processes current running. Then
for each process, you may use Process.MainModule.FileName to get the
process's main module's full file path.(You can compare this with your
application's path to determine if it is your application's process)

===============================
Please apply my suggestion above and let me know if it helps resolve your
problem.

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #2
You unfortunately answered the question I asked and not the question I
thought I asked ...

Is there a way to shutdown the running task after you have identified it or
are you restricted to "tell the user to shut it down and exit the
uninstall"?

My assumption is that there is no way to shut it down.

--
-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
--

""Jeffrey Tan[MSFT]"" <v-*****@online.microsoft.com> wrote in message
news:j9**************@cpmsftngxa06.phx.gbl...
Hi Thom,

Based on my understanding, you want to un-install an application, so you
want to know whether an application is running before un-install.

================================
You can refer to System.Diagnostics namespace.

You can use Process.GetProcessesByName method to return a list of running
processes, whoes name is your application.

If you can not determine your application's name, I think you may use
Process.GetProcesses method to get all the processes current running. Then
for each process, you may use Process.MainModule.FileName to get the
process's main module's full file path.(You can compare this with your
application's path to determine if it is your application's process)

===============================
Please apply my suggestion above and let me know if it helps resolve your
problem.

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #3
Hi Thom,

Thanks very much for your feedback.

If you have determined the process is running now, the normal way is notify
the user that the application is going to be un-installed, and letting the
user to close it properly.

You also may use Process.Kill method to terminate it yourself, but data
edited by the process or resources allocated to the process can be lost. So
it is not recommanded to use this way.

All in all, you should use your second option.

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #4
Hi Thom,

Does my reply make sense to you? Do you still have any concern on this
issue?

Please feel free to post. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #5
It ALMOST does. What came up with was ...

using System ;
using System.Windows.Forms ;
using System.Diagnostics ;

namespace ThomLittleAssociates
{
public class tlaSystemTrayDetect
{
public static void Main( string[] args )
{
for ( ; ; )
{
Process[] procMain = Process.GetProcessesByName(
"tlaSystemTray" );
if ( procMain.Length > 0 )
MessageBox.Show( "Your system is currently running
tlaSystemTray.\nRight-clicktlaSystemTray and select Exit.\nThen respond OK
to this message.", "tlaSystemTray" );
else
break ;
}
}
}
}

.... and this works fine when added as a custom action to uninstall.

The only problem is that it displays an empty command line window as it
runs.

My NEXT dumb question is how do I get rid of the bogus command line window?

--
-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
--

""Jeffrey Tan[MSFT]"" <v-*****@online.microsoft.com> wrote in message
news:ie**************@cpmsftngxa06.phx.gbl...
Hi Thom,

Does my reply make sense to you? Do you still have any concern on this
issue?

Please feel free to post. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #6
I found it ...

I needed to change the Output Type for this class to Windows Application.

The uninstall is now running correctly and it will sit in the loop waiting
for all occurrences of the application to be removed.

It is really strange that two standard dialogs are not present in the MSI
....

1. Start this application after installation.
2. Shut down this application if running during uninstall.

--
-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
--

"Thom Little" <th**@tlanet.net> wrote in message
news:uF**************@TK2MSFTNGP10.phx.gbl...
It ALMOST does. What came up with was ...

using System ;
using System.Windows.Forms ;
using System.Diagnostics ;

namespace ThomLittleAssociates
{
public class tlaSystemTrayDetect
{
public static void Main( string[] args )
{
for ( ; ; )
{
Process[] procMain = Process.GetProcessesByName(
"tlaSystemTray" );
if ( procMain.Length > 0 )
MessageBox.Show( "Your system is currently running
tlaSystemTray.\nRight-clicktlaSystemTray and select Exit.\nThen respond OK
to this message.", "tlaSystemTray" );
else
break ;
}
}
}
}

... and this works fine when added as a custom action to uninstall.

The only problem is that it displays an empty command line window as it
runs.

My NEXT dumb question is how do I get rid of the bogus command line window?
--
-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
--

""Jeffrey Tan[MSFT]"" <v-*****@online.microsoft.com> wrote in message
news:ie**************@cpmsftngxa06.phx.gbl...
Hi Thom,

Does my reply make sense to you? Do you still have any concern on this
issue?

Please feel free to post. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.


Nov 16 '05 #7
Hi Thom,

I think the dialog for "Shut down this application if running during
uninstall" does exisit but the wording is a little bit different.

The dialogs in MSI are quite different from the dialogs in WinForm
applications. We have the option to author our customized MSI dialogs,
either through VS.Net Setup project, or through Windows Installer Platform
SDK.

If you need any further assistance on MSI issues, please feel free to post
under "microsoft.public.platformsdk.msi".

Regards,

Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #8

I searched rather aggressively with no luck. If dialogs for ...

1. Start this application after installation.
2. Shut down this application if running during uninstall.

.... exist in the MSI their location is the best kept secret in Visual Studio
..NET 2003.

Do you have a suggested information source?
--
-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
--

"Felix Wang" <v-*****@online.microsoft.com> wrote in message
news:T%***************@cpmsftngxa10.phx.gbl...
Hi Thom,

I think the dialog for "Shut down this application if running during
uninstall" does exisit but the wording is a little bit different.

The dialogsI looked rather agressibely and if ...Setup project, or through Windows Installer Platform SDK.

If you need any further assistance on MSI issues, please feel free to post
under "microsoft.public.platformsdk.msi".

Regards,

Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #9
Hi Thom,

Thanks for your update. The "2. Shut down this application if running
during uninstall." dialog is not shown in VS.Net. If we open the MSI
generated by Setup project with Windows Installer Platform SDK tool "Orca",
we can see there is a dialog named "FilesInUse", which contains the
following "Text" control:

The following applications are using files which the installer must update.
You can either close the applications and click "Try Again", or click
"Continue" so that the installer continues the installation, and replaces
these files when your system restarts.

Regards,

Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #10
Hi Thom,

Does my colleague's reply make sense to you? Do you still have any concern
on this issue?

Please feel free to post. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #11
I don't know what to do with the information. I wrote a custom xxx that
sits in a loop displaying a MessageBox and you must shut the application
down.

How do I get Orca and how does it relate to the MSI setup that I have
created?

--
-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
--

""Jeffrey Tan[MSFT]"" <v-*****@online.microsoft.com> wrote in message
news:CP*************@cpmsftngxa10.phx.gbl...
Hi Thom,

Does my colleague's reply make sense to you? Do you still have any concern
on this issue?

Please feel free to post. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #12
Hi Thom,

Thanks for your update.

Generally speaking, Windows Installer has the capability to detect that
files are in use by itself. As a result, it will display the dialog I
mentioned to warn the customer before the uninstallation actually starts.
If we ignore the warning and keep the file opened, Windows Installer will
prompt us for reboot after the uninstallation. After the reboot, it will
remove the in-use file. Generally we do not need to worry too much about
the point.

As far as Orca is concerned, it is a Windows Installer Platform SDK tool:

HOWTO: Use the Orca Database Editor to Edit Windows Installer Files
http://support.microsoft.com/?id=255905

If you need any assistance on Windows Installer, please feel free to post
under microsoft.public.platformsdk.msi.

Regards,

Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #13
Great ... almost ...

I installed the SDK and ran Orca and pointed it at my .msi file. The dialog
that you referred to is present in the Dialog Viewer and apparently sitting
in my MSI file.

What's the "trick" to enable the display of the dialog?

--
-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
--

"Felix Wang" <v-*****@online.microsoft.com> wrote in message
news:Oo**************@cpmsftngxa10.phx.gbl...
Hi Thom,

Thanks for your update.

Generally speaking, Windows Installer has the capability to detect that
files are in use by itself. As a result, it will display the dialog I
mentioned to warn the customer before the uninstallation actually starts.
If we ignore the warning and keep the file opened, Windows Installer will
prompt us for reboot after the uninstallation. After the reboot, it will
remove the in-use file. Generally we do not need to worry too much about
the point.

As far as Orca is concerned, it is a Windows Installer Platform SDK tool:

HOWTO: Use the Orca Database Editor to Edit Windows Installer Files
http://support.microsoft.com/?id=255905

If you need any assistance on Windows Installer, please feel free to post
under microsoft.public.platformsdk.msi.

Regards,

Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #14
Hi Thom,

You can use the menu "Tools" | "Dialog Preview" ;-)

Regards,

Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #15
Thank you for pointing out that I was being less than clear.

Yes you can display the dialog box in Orca using Tools | Dialog Preview...

The question I was trying to ask is how do I trigger the display of the
dialog box at install time and uninstall time when the other dialog boxes
are presented?

--
-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
--

"Felix Wang" <v-*****@online.microsoft.com> wrote in message
news:DG**************@cpmsftngxa10.phx.gbl...
Hi Thom,

You can use the menu "Tools" | "Dialog Preview" ;-)

Regards,

Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #16
Hi Thome,

The "FilesInUse" dialog is takend care of by Windows Installer. We don't
need to display it explicitly:

FilesInUse Dialog
http://msdn.microsoft.com/library/de...us/msi/setup/f
ilesinuse_dialog.asp?frame=true

If you would like to show it, we can modify the "ControlEvent" table and
hook a button with "SpawnDialog" event to show it.

Regards,

Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #17
>If you would like to show it, we can modify the "ControlEvent" table and
hook a button with "SpawnDialog" event to show it.
I would indeed like to show it when appropriate during an install and during
an uninstall.

How the tables are manipulated in Orca control this process is not obvious
to me and it is apparently obvious to you.
hook a button with "Spawn Dialog"
Which button?
What conditions?

I am coming from a MSI environment and was surprised that this capability
was not in MSI. I wrote my own version. I was told it was already there
and just not enabled so what I developed was redundant. All I am trying to
do is enable an option that should have been in MSI in the first place using
a tool that was installed after installing the SDK.

I wonder what application I could come up with that would use MSI that would
not want to check for an executing copy of the application and give the user
the opportunity to shut it down.

Any "baby steps" you can provide in the use of Orca to perform this
apparently trivial task would be greatly appreciated/

--
-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
--

"Felix Wang" <v-*****@online.microsoft.com> wrote in message
news:c1*************@cpmsftngxa10.phx.gbl... Hi Thome,

The "FilesInUse" dialog is takend care of by Windows Installer. We don't
need to display it explicitly:

FilesInUse Dialog
http://msdn.microsoft.com/library/de...us/msi/setup/f ilesinuse_dialog.asp?frame=true

If you would like to show it, we can modify the "ControlEvent" table and
hook a button with "SpawnDialog" event to show it.

Regards,

Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #18
Hi Thom,

As I mentioned, the dialog will be shown automatically if Windows Installer
detects the file is in use. We don't need to worry about it.

In addition, it is not an easy task to modify the user interface with Orca
directly. It needs comprehensive understanding on how MSI works:

User Interface
http://msdn.microsoft.com/library/?u...p/user_interfa
ce.asp?frame=true

Regards,

Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #19
Hi Felix,

I am using MSI and the dialog in question is never automatically displayed.
This is the whole purpose of starting this quest.

My assumption is (from your previous instructions) that when using Orca I
can change the .msi file to enable it to automatically generate the dialog
at install and uninstall time when needed.

This enabling is the only thing I am attempting to do with Orca (in
accordance with your previous instructions).

How do enable the behavior of (1) detect if a specific program is in
execution (2) if not in execution do nothing (3) if in execution display the
dialog with three options?

Please help.

Regards,

Thom Little

--
-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
--

"Felix Wang" <v-*****@online.microsoft.com> wrote in message
news:6e*************@cpmsftngxa10.phx.gbl...
Hi Thom,

As I mentioned, the dialog will be shown automatically if Windows Installer detects the file is in use. We don't need to worry about it.

In addition, it is not an easy task to modify the user interface with Orca
directly. It needs comprehensive understanding on how MSI works:

User Interface
http://msdn.microsoft.com/library/?u...p/user_interfa ce.asp?frame=true

Regards,

Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #20
Hi Thom,

We cannot force MSI to show that dialog. It will show the dialog when it
thinks it is necessary. Just for a simple example:

1. Create a bare bone Windows application.
2. Add a new Setup project to the solution.
3. Add the primary output of the Windows application to the Setup project.
4. Build the Setup project.
5. Install the MSI generated on a test Windows XP machine.
6. Open the Windows application installed. Keep the window open.
7. Right-click the MSI and select "Uninstall".
8. You will see the dialog saying that we should close the application
before continuing the install.

Please give it a try and see whether this helps or not.

Regards,

Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #21
Felix:

Thank you ... that was exactly the lead I needed.

The dialog is automatically displayed during an uninstall if
ShowInToolbar is True and the application is active
If either is not the case then the dialog is not shown.

My application is a slight hack (of course) and does not display the form or
display the application on the toolbar. (My application is controlled
through an icon in the system tray.) As a result, the dialog is never
triggered during an uninstall if the application is running.

I apparently will need to continue using my custom action during uninstall
to get the application shut down.

Thanks again.

--
-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
--

"Felix Wang" <v-*****@online.microsoft.com> wrote in message
news:UA**************@cpmsftngxa10.phx.gbl...
Hi Thom,

We cannot force MSI to show that dialog. It will show the dialog when it
thinks it is necessary. Just for a simple example:

1. Create a bare bone Windows application.
2. Add a new Setup project to the solution.
3. Add the primary output of the Windows application to the Setup project.
4. Build the Setup project.
5. Install the MSI generated on a test Windows XP machine.
6. Open the Windows application installed. Keep the window open.
7. Right-click the MSI and select "Uninstall".
8. You will see the dialog saying that we should close the application
before continuing the install.

Please give it a try and see whether this helps or not.

Regards,

Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #22
Hi Thome,

Thanks for your update.

However, the .Net custom actions may not be able to achieve your goal here,
as they are run after the default checking performed by Windows Installer.

You may give it a try and see whether the custom actions help or not.

Regards,

Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #23
The uninstall custom action I had created and used earlier continues to work
correctly.

Mine requires that you shut down the application before you are allowed to
continue in the uninstall.

--
-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
--

"Felix Wang" <v-*****@online.microsoft.com> wrote in message
news:Zt**************@cpmsftngxa10.phx.gbl...
Hi Thome,

Thanks for your update.

However, the .Net custom actions may not be able to achieve your goal here, as they are run after the default checking performed by Windows Installer.

You may give it a try and see whether the custom actions help or not.

Regards,

Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #24
Hi Thom,

I am glad to hear that the custom action works. If you have any further
concerns, please feel free to post here. You may also post MSI related
issues under "microsoft.public.platformsdk.msi". I believe you will get
more responses there.

Have a nice day.

Regards,

Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #25

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: David Bolen | last post by:
Although it isn't often necessary, I tend to be in the habit of uninstalling Python before updating to new minor releases, or especially during the alpha/beta cycle. I'm in the process of...
2
by: Dave A | last post by:
I have an application that runs in the system tray (taskbar notification area) and it runs at startup. Occasionally I need to release a new version. I have created a deployment project in .Net. ...
3
by: Thom Little | last post by:
During an uninstall, how can I check to see if the application I an uninstalling is currently running? -- -- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd. --
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.