| View previous topic :: View next topic |
| Author |
Message |
danway60 Expert Cheater
Reputation: 0
Joined: 13 Jun 2007 Posts: 209
|
Posted: Thu Feb 14, 2008 7:43 pm Post subject: VB 2008 Openig Closing and Checking Programs |
|
|
Can some one help me.
I want to make a program that can open and external program that I have, and a timer to check if it still open, and close and how to close the program.
I can get it to open, but I can't find a way of checking to see if the window is still open.
Thankyou Dan.
_________________
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Thu Feb 14, 2008 7:51 pm Post subject: |
|
|
CreateProcess
FindWindow
pinvoke.net / msdn
|
|
| Back to top |
|
 |
danway60 Expert Cheater
Reputation: 0
Joined: 13 Jun 2007 Posts: 209
|
Posted: Thu Feb 14, 2008 8:01 pm Post subject: |
|
|
| slovach wrote: |
pinvoke.net / msdn |
obvi take spaces out..but it dont work mush!
_________________
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
|
| Back to top |
|
 |
danway60 Expert Cheater
Reputation: 0
Joined: 13 Jun 2007 Posts: 209
|
Posted: Sat Feb 16, 2008 7:39 am Post subject: |
|
|
Would it be possible for you to provide an example?
Say, checking to see if notepad is open. and a msgbox opening saying that the program is found, and another which would say if the program was not open.
I find it hard to read through all that as it has C# and stuff on it.
Thanks, dan.
_________________
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
|
| Back to top |
|
 |
danway60 Expert Cheater
Reputation: 0
Joined: 13 Jun 2007 Posts: 209
|
Posted: Sun Feb 17, 2008 6:49 pm Post subject: |
|
|
Where in:
| Code: | <DllImport("kernel32.dll", SetLastError:=True)> _
Public Function TerminateProcess(ByVal hProcess As IntPtr, ByVal uExitCode As System.UInt32) As Boolean
End Function |
Would I put what window I want to close?
_________________
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Sun Feb 17, 2008 7:16 pm Post subject: |
|
|
First off, I don't know VB's syntax so just change this to however it's included.
using System.Runtime.InteropServices;
Then add your imports below to declare them, you can then just call the API as expected.
Look on pinvoke.net and see if there's managed alternatives first off, as it will be simpler. Such as instead of having to use TerminateProcess, you can use System.Diagnostics.Process.Kill()
|
|
| Back to top |
|
 |
danway60 Expert Cheater
Reputation: 0
Joined: 13 Jun 2007 Posts: 209
|
Posted: Mon Feb 18, 2008 6:09 pm Post subject: |
|
|
| slovach wrote: | | System.Diagnostics.Process.Kill() |
Um..No such thing lol
_________________
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
|
| Back to top |
|
 |
|