473,404 Members | 2,137 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,404 software developers and data experts.

Shutting down COM app from a command line

Not sure where else to post this.... One of our developers quit and
I'm taking over stuff from him.

He had a COM app that would lock files on occasion (yeah, thanks for
leaving that in production instead of finding the real problem)...
anyway, the "fix" was to shut down the com app when it would lock the
file.

Any way to do that from a command line?

Jul 30 '07 #1
4 3679
What do you mean by "COM app". An EXE? A COM+ Application?

"Larry Bud" <la**********@yahoo.comwrote in message
news:11**********************@x35g2000prf.googlegr oups.com...
Not sure where else to post this.... One of our developers quit and
I'm taking over stuff from him.

He had a COM app that would lock files on occasion (yeah, thanks for
leaving that in production instead of finding the real problem)...
anyway, the "fix" was to shut down the com app when it would lock the
file.

Any way to do that from a command line?

Jul 30 '07 #2
"Larry Bud" <larrybud2...@yahoo.comwrote in message

news:11**********************@x35g2000prf.googlegr oups.com...
Not sure where else to post this.... One of our developers quit and
I'm taking over stuff from him.
He had a COM app that would lock files on occasion (yeah, thanks for
leaving that in production instead of finding the real problem)...
anyway, the "fix" was to shut down the com app when it would lock the
file.
Any way to do that from a command line?- Hide quoted text -
On Jul 30, 10:50 am, "Aidy" <a...@xxnoemailxx.comwrote:
What do you mean by "COM app". An EXE? A COM+ Application?
Sorry.

Yes, a COM+ Application.
Jul 30 '07 #3
You could script it or make a small app to do it;

http://www.devx.com/vb2themax/Tip/19633

"Larry Bud" <la**********@yahoo.comwrote in message
news:11**********************@d30g2000prg.googlegr oups.com...
>
>"Larry Bud" <larrybud2...@yahoo.comwrote in message

news:11**********************@x35g2000prf.googleg roups.com...
Not sure where else to post this.... One of our developers quit and
I'm taking over stuff from him.
He had a COM app that would lock files on occasion (yeah, thanks for
leaving that in production instead of finding the real problem)...
anyway, the "fix" was to shut down the com app when it would lock the
file.
Any way to do that from a command line?- Hide quoted text -

On Jul 30, 10:50 am, "Aidy" <a...@xxnoemailxx.comwrote:
>What do you mean by "COM app". An EXE? A COM+ Application?

Sorry.

Yes, a COM+ Application.


Jul 30 '07 #4
using System;
using System.Collections;
using System.Collections.Specialized;
using COMAdmin; // This needs a reference to the "COM+ Admin" dll on
the COM tab

namespace xxx
{
class ShutdownCom
{
#region Get COM+ Applications
public StringCollection GetCOMApplications()
{
StringCollection collection = new StringCollection();
try
{
ICOMAdminCatalog objAdmin;
ICatalogCollection objCollection;

objAdmin = (ICOMAdminCatalog) new
COMAdmin.COMAdminCatalog();
objCollection = (ICatalogCollection)
objAdmin.GetCollection("Applications");
objCollection.Populate();

foreach(COMAdmin.COMAdminCatalogObject objApp in
objCollection)
{
collection.Add(objApp.Name.ToString());
// Console.WriteLine(objApp.Name.ToString());
}
}
catch(Exception ex)
{
Console.WriteLine("Error: " + ex.Message);
return null;
}
return collection;
}
#endregion

#region Shutting Down COM+ Application
public void ShutDownCOMApplication(string appName)
{
try
{
ICOMAdminCatalog objAdmin;
ICatalogCollection objCollection;

objAdmin = (ICOMAdminCatalog) new
COMAdmin.COMAdminCatalog();
objCollection = (ICatalogCollection)
objAdmin.GetCollection("Applications");

Console.WriteLine("Shutting down: " + appName);
objAdmin.ShutdownApplication(appName);
}
catch(Exception ex)
{
Console.WriteLine("Unable to shutdown the application, err=" +
ex.Message);
}
}
#endregion
[STAThread]
static void Main(string[] args)
{
// create an instance of our class
ShutdownCom shutdown = new ShutdownCom();

// shutdown all applications that begin with ZC
StringCollection appList = shutdown.GetCOMApplications();
foreach (string appName in appList)
{
if (appName.ToUpper().StartsWith("ZC"))
shutdown.ShutDownCOMApplication(appName);
}
}
}
}

Jul 31 '07 #5

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

Similar topics

10
by: Jesper | last post by:
Does anyone know some c++ code for shutting down windows? I want to write a program using borland c++ builder to shut down windows. --
1
by: mikelostcause | last post by:
I'm working on shutting down an app that runs in the system tray, I have no problems shutting down, but I have problems saving data first. if the base.WndProc(ref m) is placed at the top, it...
2
by: Mike Stephens | last post by:
I have an application to minimizes when X is clicked. If the user wants to close the application they click the Exit Application button.This works fine and does exactly what I need. I have since...
3
by: diffuser78 | last post by:
I am a newbie in Python and want your help in writing python script. I have to remotely shut the windows px from linux box. I run OpenSSH on windows PC. I remotely connect it from Linux box using...
4
by: Markus Stoeger | last post by:
Hi, I have a problem with Application.Run() when Windows is shutting down. Please have a look at the copy&paste example program below. The application has no forms. It has only got a notify...
7
by: Mark | last post by:
It is possible from a .NET application to prevent Windows from shutting down? I understand that a .NET application can "know" that windows is initiating the process of to shutting down - but...
3
by: leocwh | last post by:
Dear all, I would like to know how to run the execuatable before windows shutting down. Here is my simple code: Private Sub Command1_Click() Shell "C:\abc.bat", vbNormalFocus End Sub ...
2
by: Jack | last post by:
Sorry for the double post (also in the IIS group). We've got an ASP.Net 2.0 app running on IIS6. We kept losing sessions, and enabled health monitoring to see what was happening. This morning...
0
by: sberry | last post by:
I have a soap server I am running on an OS X Server using SOAPpy. To start the server I am running server = SOAPpy.SOAPServer(('IPADDRESS", PORT), namespace=NAMESPACE) server.serve_forever() I...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.