stopping a process



I have converted serveral vb6 applications to One of these
applications originally would stop one of my applications by using the
findwindow api and using the sendmessage api to close the app.

I thought it would be easy enough to convert that api call to use the
process class. I can get the process by woProcess() =
process.getprocessesbyname("apptoclose"). The use the closemainwindow

This does get a reference to the process. The closemainwindow does not
work. I checked and the mainwindowhandle is zero and the mainwindowtitle is
blank. As best as I can tell the reason that they are blank is due to the
fact that I have set the "showintaskbar" to false in the application that I
want to close. (When it shows in the task bar, it works.)

The application that I want to close is running in the systemtray. I set
the showintaskbar to false just like I did for my vb6 application. No
differences there.

Is there a way to request this application to close from without
using api? I don't want to use the kill option. That leaves the icon in the
system tray.

I put my original findwindow api back in the application that wants to close
the one in the system tray. It does not find the application. I think the
reason for it not working now is the fact that "showintaskbar" set to false
removes the application from the task manager's application tab. The vb6
application shows in the application tab and the processes tab. The
application only shows in the process tab.

It is interesting to note that my application will close the vb6
system tray application by using process.closemainwindow. It however will
not close the same system tray app. It appears as though the
app does not have a main window when the "showintaskbar" option is set to

Any thoughts?



Cor Ligthert [MVP]


If you use in a windowforms application in the mainform "me.close" and you
did use only managed code and no unmanaged resources.

Than your program will nicely close and everything will be cleaned.

(Try to make your newsgroup messages shorter. It gives you more change on a
answer. If somebody don't understand you, than he will tell that)

I hope this helps,





The system tray application will close if I click on the X associated
with it's window. It uses all managed resources. I am trying to close it
from a second application without using unmanaged api.

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question