473,669 Members | 2,395 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3695
What do you mean by "COM app". An EXE? A COM+ Application?

"Larry Bud" <la**********@y ahoo.comwrote in message
news:11******** **************@ x35g2000prf.goo glegroups.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...@y ahoo.comwrote in message

news:11******** **************@ x35g2000prf.goo glegroups.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...@xxnoemail xx.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**********@y ahoo.comwrote in message
news:11******** **************@ d30g2000prg.goo glegroups.com.. .
>
>"Larry Bud" <larrybud2...@y ahoo.comwrote in message

news:11******* *************** @x35g2000prf.go oglegroups.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...@xxnoemail xx.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.Collecti ons;
using System.Collecti ons.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 StringCollectio n GetCOMApplicati ons()
{
StringCollectio n collection = new StringCollectio n();
try
{
ICOMAdminCatalo g objAdmin;
ICatalogCollect ion objCollection;

objAdmin = (ICOMAdminCatal og) new
COMAdmin.COMAdm inCatalog();
objCollection = (ICatalogCollec tion)
objAdmin.GetCol lection("Applic ations");
objCollection.P opulate();

foreach(COMAdmi n.COMAdminCatal ogObject objApp in
objCollection)
{
collection.Add( objApp.Name.ToS tring());
// Console.WriteLi ne(objApp.Name. ToString());
}
}
catch(Exception ex)
{
Console.WriteLi ne("Error: " + ex.Message);
return null;
}
return collection;
}
#endregion

#region Shutting Down COM+ Application
public void ShutDownCOMAppl ication(string appName)
{
try
{
ICOMAdminCatalo g objAdmin;
ICatalogCollect ion objCollection;

objAdmin = (ICOMAdminCatal og) new
COMAdmin.COMAdm inCatalog();
objCollection = (ICatalogCollec tion)
objAdmin.GetCol lection("Applic ations");

Console.WriteLi ne("Shutting down: " + appName);
objAdmin.Shutdo wnApplication(a ppName);
}
catch(Exception ex)
{
Console.WriteLi ne("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
StringCollectio n appList = shutdown.GetCOM Applications();
foreach (string appName in appList)
{
if (appName.ToUppe r().StartsWith( "ZC"))
shutdown.ShutDo wnCOMApplicatio n(appName);
}
}
}
}

Jul 31 '07 #5

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

Similar topics

10
18635
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
2059
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 closes, but the system does not continue to shutdown and it does not save the data via the Logout() funtion. If the base.WndProc(ref m) is placed at the bottom, it closes correctly, but doesn't seem to perform the Logout function. protected...
2
19930
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 discovered it is holding Windows open when you shutdown. If the application is running and the user shutsdown Window it holds up everything. If the application is not running and the user shutsdown Windows is shutsdown in a timely manner. How...
3
5127
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 ..... ssh Admin@IP_ADDR # connects me fine now without problems (LOCAL) Next, I wrote a script that would log me in and also shut the windows
4
3403
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 icon in the system tray and it uses Application.Run() to keep the message loop running. When the user clicks the icon, the application should shut down and exit. So far that works fine.
7
4263
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 what about *preventing* that shutdown? (and yes - I know the user can always unplug the machine) Thanks.
3
3179
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 Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
2
13662
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 the got the following in the logs. Any idea what would cause it? Event code: 1002 Event message: Application is shutting down. Reason: Hosting environment is shutting down. Event time: 7/17/2007 10:28:37 AM
0
1016
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 am starting the server manually in the background by running from the command line as follows: ../mySOAPServer.py & However, when I log out of my ssh session, the server often stops
0
8383
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8895
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8588
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7407
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6210
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5682
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4206
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4386
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1788
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.