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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

End process with program in VisualBasic6

Status
Not open for further replies.

rikeman

Programmer
Sep 18, 2004
40
BE
Hello,

Does somebody know how I can end a progress when I click on a command button with a VisualBasic program?
Ex.: When I click on the command button, the process msnmsgr.exe must stop (MSN Messenger must end)

Regards.
 
I have already found it:

Dim Process As Variant
strProcess = "Program to end"
For Each Process In GetObject("winmgmts:").ExecQuery("Select * from Win32_Process Where Name = '" & strProcess & "'")
Process.Terminate
Next

But I have one question more: how can I get the filesize of a file?

Regards.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top