[Help]Unable to Suspend a Thread.
Trouble Suspending Thread.
Edit: This is Visual Basic 6.
The only solution is I am missing something or my request is denied.
I'm able to open the thread without errors but SuspendThread just doesn't want to work. (Tried on a few applications and all failed).
Declarations:
Function:
Edit: This is Visual Basic 6.
The only solution is I am missing something or my request is denied.
I'm able to open the thread without errors but SuspendThread just doesn't want to work. (Tried on a few applications and all failed).
Declarations:
Code:
Private Declare Function ResumeThread Lib "kernel32.dll" (ByVal hThread As Long) As Long Private Declare Function SuspendThread Lib "kernel32.dll" (ByVal hThread As Long) As Long Private Declare Function OpenThread Lib "kernel32.dll" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwThreadId As Long) As Long Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long Private Const SUSPEND_RESUME = &H2 'This could be my problem. 'Same as GetWindowThreadProcessId (DUR) Public Declare Function GetThreadID Lib "user32" Alias "GetWindowThreadProcessId" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
Code:
hwnd = FindWindow("GFC_StdWindowClass", vbNullString)
If hwnd > 0 Then
PID = GetWindowThreadProcessId(hwnd, lngPID)
hProcess = OpenThread(SUSPEND_RESUME, False, PID)
If hProcess <> 0 Then
Call SuspendThread(PID)

