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 


vb6 kill process

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

Joined: 03 Dec 2007
Posts: 82
Location: Faroe islands

PostPosted: Tue Sep 23, 2008 9:44 am    Post subject: vb6 kill process Reply with quote

how can i close java.exe with vb6?
_________________
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Tue Sep 23, 2008 12:53 pm    Post subject: Reply with quote

TerminateProcess
Back to top
View user's profile Send private message
minium haxor
Advanced Cheater
Reputation: 0

Joined: 03 Dec 2007
Posts: 82
Location: Faroe islands

PostPosted: Tue Sep 23, 2008 1:54 pm    Post subject: Reply with quote

wow i understand it so well.. how the hell do i use this?
_________________
Back to top
View user's profile Send private message
Innovation
Grandmaster Cheater
Reputation: 12

Joined: 14 Aug 2008
Posts: 617

PostPosted: Tue Sep 23, 2008 2:47 pm    Post subject: Reply with quote

Google is there if you want to search how to use TerminateProcess...
Back to top
View user's profile Send private message
pkedpker
Master Cheater
Reputation: 1

Joined: 11 Oct 2006
Posts: 412

PostPosted: Tue Sep 23, 2008 5:29 pm    Post subject: Reply with quote

Inside a module (BAS FILE) add this

Code:


Option Explicit

Private Declare Function CloseHandle Lib "Kernel32.dll" (ByVal Handle As Long) As Long
Private Declare Function OpenProcess Lib "Kernel32.dll" (ByVal dwDesiredAccessas As Long, ByVal bInheritHandle As Long, ByVal dwProcId As Long) As Long
Private Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long
Private Declare Function CreateToolhelpSnapshot Lib "kernel32" Alias "CreateToolhelp32Snapshot" (ByVal lFlags As Long, lProcessID As Long) As Long
Private Declare Function ProcessFirst Lib "kernel32" Alias "Process32First" (ByVal hSnapshot As Long, uProcess As PROCESSENTRY32) As Long
Private Declare Function ProcessNext Lib "kernel32" Alias "Process32Next" (ByVal hSnapshot As Long, uProcess As PROCESSENTRY32) As Long
Private Declare Function GetVersionExA Lib "kernel32" (lpVersionInformation As OSVERSIONINFO) As Integer

Private Type PROCESSENTRY32
   dwSize As Long
   cntUsage As Long
   th32ProcessID As Long
   th32DefaultHeapID As Long
   th32ModuleID As Long
   cntThreads As Long
   th32ParentProcessID As Long
   pcPriClassBase As Long
   dwFlags As Long
   szExeFile As String * 260
End Type
Private Type OSVERSIONINFO
   dwOSVersionInfoSize As Long
   dwMajorVersion As Long
   dwMinorVersion As Long
   dwBuildNumber As Long
   dwPlatformId As Long
   szCSDVersion As String * 128
End Type
Private Const PROCESS_ALL_ACCESS = 0
Private Const TH32CS_SNAPPROCESS As Long = 2&

Private Const WINNT As Integer = 2
Private Const WIN98 As Integer = 1

Public KillAppReturn As Boolean
Public Function getVersion() As Integer
 Dim udtOSInfo As OSVERSIONINFO
 Dim intRetVal As Integer
       
   With udtOSInfo
       .dwOSVersionInfoSize = 148
       .szCSDVersion = Space$(128)
   End With
   
   intRetVal = GetVersionExA(udtOSInfo)
 
   getVersion = udtOSInfo.dwPlatformId
End Function

Public Function Killapp(myName As String)
Select Case getVersion()
Case WIN98
Killapp9X (myName)
Case WINNT
KillappNT (myName)
End Select
End Function

Private Function KillappNT(myName As String)
   Dim uProcess As PROCESSENTRY32
   Dim rProcessFound As Long
   Dim hSnapshot As Long
   Dim szExename As String
   Dim exitCode As Long
   Dim myProcess As Long
   Dim AppKill As Boolean
   Dim appCount As Integer
   Dim I As Integer
   On Local Error GoTo Finish
   appCount = 0
   uProcess.dwSize = Len(uProcess)
   hSnapshot = CreateToolhelpSnapshot(TH32CS_SNAPPROCESS, 0&)
   rProcessFound = ProcessFirst(hSnapshot, uProcess)
   Do While rProcessFound
       I = InStr(1, uProcess.szExeFile, Chr(0))
       szExename = LCase$(Left$(uProcess.szExeFile, I - 1))
       If Right$(szExename, Len(myName)) = LCase$(myName) Then
           KillAppReturn = True
           appCount = appCount + 1
           myProcess = OpenProcess(1&, -1&, uProcess.th32ProcessID)
           AppKill = TerminateProcess(myProcess, 0&)
           Call CloseHandle(myProcess)
       End If
       rProcessFound = ProcessNext(hSnapshot, uProcess)
   Loop
   Call CloseHandle(hSnapshot)
Finish:
KillAppReturn = False
End Function

Private Function Killapp9X(myName As String)
   Dim uProcess As PROCESSENTRY32
   Dim rProcessFound As Long
   Dim hSnapshot As Long
   Dim szExename As String
   Dim exitCode As Long
   Dim myProcess As Long
   Dim AppKill As Boolean
   Dim appCount As Integer
   Dim I As Integer
   On Local Error GoTo Finish
   appCount = 0
   uProcess.dwSize = Len(uProcess)
   hSnapshot = CreateToolhelpSnapshot(TH32CS_SNAPPROCESS, 0&)
   rProcessFound = ProcessFirst(hSnapshot, uProcess)
   Do While rProcessFound
       I = InStr(1, uProcess.szExeFile, Chr(0))
       szExename = LCase$(Left$(uProcess.szExeFile, I - 1))
       If Right$(szExename, Len(myName)) = LCase$(myName) Then
           KillAppReturn = True
           appCount = appCount + 1
           myProcess = OpenProcess(PROCESS_ALL_ACCESS, False, uProcess.th32ProcessID)
           AppKill = TerminateProcess(myProcess, exitCode)
           Call CloseHandle(myProcess)
       End If
       rProcessFound = ProcessNext(hSnapshot, uProcess)
   Loop
   Call CloseHandle(hSnapshot)
Finish:
KillAppReturn = False
End Function


then just use

Killapp "java.exe"

_________________
Hacks I made for kongregate.
Kongregate Universal Badge Hack: http://forum.cheatengine.org/viewtopic.php?p=4129411
Kongreate Auto Rating/Voter hack: http://forum.cheatengine.org/viewtopic.php?t=263576
Took a test lol
Back to top
View user's profile Send private message
kitterz
Grandmaster Cheater Supreme
Reputation: 0

Joined: 24 Dec 2007
Posts: 1268

PostPosted: Tue Sep 23, 2008 8:06 pm    Post subject: Reply with quote

wow that's so long...lol....I can make a function that kills a process in C++ with what...20 lines? lol vb it seems much more complicated.
_________________
Back to top
View user's profile Send private message Send e-mail
Wintermoot
Expert Cheater
Reputation: 0

Joined: 08 Nov 2007
Posts: 198

PostPosted: Wed Sep 24, 2008 8:27 pm    Post subject: Reply with quote

No, it takes so long because VB likes making simple things annoying. It requires declaring a lot of things which takes a lot of room. It is usually siggested that you use a module to do stuff like that.
Back to top
View user's profile Send private message
minium haxor
Advanced Cheater
Reputation: 0

Joined: 03 Dec 2007
Posts: 82
Location: Faroe islands

PostPosted: Wed Sep 24, 2008 10:39 pm    Post subject: Reply with quote

i found another code....



Code:


Option Explicit
Private Sub TerminateProcess(app_exe As String)
Dim Process As Object
For Each Process In GetObject("winmgmts:").ExecQuery("Select Name from Win32_Process Where Name = '" & app_exe & "'")
Process.Terminate
Next
End Sub

Private Sub Timer1_Timer()
   Static count As Integer
   count = count + 1
   If count = 1800 Then
      count = 0
      TerminateProcess ("java.exe")
      Timer2.Enabled = True
   End If
End Sub




and thanks for helping

_________________
Back to top
View user's profile Send private message
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