Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help closing an App

Status
Not open for further replies.

marieva1

Programmer
Jun 15, 2000
3
US
Hi there,

Could someone tell me how to shutdown a window application by NAME using Visual Basic?

Thanks in advance.
 
What ho,

here's a way which I reckon'd work, although it's not particularly elegant...

Get hold of a copy of Microsoft Kill.exe (comes with Windows apparantly)

Kill.exe takes one argument which can either be the process ID of the app you want to terminate or it can be a pattern, defined as:

<pattern>
The pattern can be a complete task
name or a regular expression pattern
to use as a match. Kill matches the
supplied pattern against the task names
and the window titles.

So you can give it the application name you want to terminate - I've tested it with notepad by opening notepad and typing

Kill notepad

at the command prompt and it shut it doen fine.

So, although I've not tried it, you could probably do a

Shell(&quot;Kill &quot; & strApplicationName)

in VB and kill your application, where strApplicationName'd be your application to terminate.


What d'ya reckon? Two thumbs fresh or load of old tosh?


Cheerio,

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top