Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


VB 2008 Openig Closing and Checking Programs

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
danway60
Expert Cheater
Reputation: 0

Joined: 13 Jun 2007
Posts: 209

PostPosted: Thu Feb 14, 2008 7:43 pm    Post subject: VB 2008 Openig Closing and Checking Programs Reply with quote

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.

_________________
http://gamecityonline.co.uk << or >> http://GAMECITYONLINE.TK << Please go on, I Like people who visit and come back.
I have hunterstory and hackerstory...and lots of others! Very Happy
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Thu Feb 14, 2008 7:51 pm    Post subject: Reply with quote

CreateProcess
FindWindow

pinvoke.net / msdn
Back to top
View user's profile Send private message
danway60
Expert Cheater
Reputation: 0

Joined: 13 Jun 2007
Posts: 209

PostPosted: Thu Feb 14, 2008 8:01 pm    Post subject: Reply with quote

slovach wrote:

pinvoke.net / msdn


obvi take spaces out..but it dont work mush! Razz

_________________
http://gamecityonline.co.uk << or >> http://GAMECITYONLINE.TK << Please go on, I Like people who visit and come back.
I have hunterstory and hackerstory...and lots of others! Very Happy
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Thu Feb 14, 2008 8:12 pm    Post subject: Reply with quote

I guess I should have been more specific.

http://www.pinvoke.net/default.aspx/kernel32/CreateProcess.html
http://www.pinvoke.net/default.aspx/user32/FindWindow.html

http://msdn2.microsoft.com/en-us/library/ms682425(VS.85).aspx
http://msdn2.microsoft.com/en-us/library/ms633499(VS.85).aspx
Back to top
View user's profile Send private message
danway60
Expert Cheater
Reputation: 0

Joined: 13 Jun 2007
Posts: 209

PostPosted: Sat Feb 16, 2008 7:39 am    Post subject: Reply with quote

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.

_________________
http://gamecityonline.co.uk << or >> http://GAMECITYONLINE.TK << Please go on, I Like people who visit and come back.
I have hunterstory and hackerstory...and lots of others! Very Happy
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Sat Feb 16, 2008 3:35 pm    Post subject: Reply with quote

Oops, I missed where you said you'd be closing it as well.

http://pinvoke.net/default.aspx/kernel32/TerminateProcess.html
http://msdn2.microsoft.com/en-us/library/ms686714.aspx

The pinvoke pages all have VB examples, they also might tell you how you can do it in managed code, so you don't have to use the API.
Back to top
View user's profile Send private message
danway60
Expert Cheater
Reputation: 0

Joined: 13 Jun 2007
Posts: 209

PostPosted: Sun Feb 17, 2008 6:49 pm    Post subject: Reply with quote

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?

_________________
http://gamecityonline.co.uk << or >> http://GAMECITYONLINE.TK << Please go on, I Like people who visit and come back.
I have hunterstory and hackerstory...and lots of others! Very Happy
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Sun Feb 17, 2008 7:16 pm    Post subject: Reply with quote

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
View user's profile Send private message
danway60
Expert Cheater
Reputation: 0

Joined: 13 Jun 2007
Posts: 209

PostPosted: Mon Feb 18, 2008 6:09 pm    Post subject: Reply with quote

slovach wrote:
System.Diagnostics.Process.Kill()

Um..No such thing lol

_________________
http://gamecityonline.co.uk << or >> http://GAMECITYONLINE.TK << Please go on, I Like people who visit and come back.
I have hunterstory and hackerstory...and lots of others! Very Happy
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Mon Feb 18, 2008 8:17 pm    Post subject: Reply with quote

danway60 wrote:
slovach wrote:
System.Diagnostics.Process.Kill()

Um..No such thing lol


http://msdn2.microsoft.com/en-us/library/system.diagnostics.process.kill.aspx

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites