Posted: Fri Aug 09, 2002 4:02 pm
Restored from previous forum. Originally posted by Kendrel.
I need help on converting the following VB functions to Purebasic code...
please help if you can... iam getting crazy with this one!
Public Function OpenPr() As Boolean
' Some memory we'll be using
Dim ProcessID As Long
' Find the window
' Get the process id
GetWindowThreadProcessId getUO, ProcessID
' Get a valid Process Handle
ProcessHandle = OpenProcess(PROCESS_ALL_ACCESS, False, ProcessID)
If ProcessHandle = 0 Then
OpenPr = False
Exit Function
Else
OpenPr = True
Exit Function
End If
End Function
Public Function getUO() As Long
Dim hwnd As Long
Dim desktop As Long
Dim sWindowText As String
Dim sClassname As String
Dim r As Long
desktop = GetDesktopWindow
hwnd = GetWindow(desktop, GW_CHILD)
Do While hwnd 0
DoEvents
sWindowText = Space$(255)
r = GetWindowText(hwnd, sWindowText, 255)
sWindowText = Left(sWindowText, r)
sClassname = Space$(255)
r = GetClassName(hwnd, sClassname, 255)
sClassname = Left(sClassname, r)
If Left$(sWindowText, 13) = "ProgName" And sClassname = "ProgName" Then
getUO = hwnd
Exit Function
End If
hwnd = GetWindow(hwnd, GW_HWNDNEXT)
Loop
End Function
I need help on converting the following VB functions to Purebasic code...
please help if you can... iam getting crazy with this one!
Public Function OpenPr() As Boolean
' Some memory we'll be using
Dim ProcessID As Long
' Find the window
' Get the process id
GetWindowThreadProcessId getUO, ProcessID
' Get a valid Process Handle
ProcessHandle = OpenProcess(PROCESS_ALL_ACCESS, False, ProcessID)
If ProcessHandle = 0 Then
OpenPr = False
Exit Function
Else
OpenPr = True
Exit Function
End If
End Function
Public Function getUO() As Long
Dim hwnd As Long
Dim desktop As Long
Dim sWindowText As String
Dim sClassname As String
Dim r As Long
desktop = GetDesktopWindow
hwnd = GetWindow(desktop, GW_CHILD)
Do While hwnd 0
DoEvents
sWindowText = Space$(255)
r = GetWindowText(hwnd, sWindowText, 255)
sWindowText = Left(sWindowText, r)
sClassname = Space$(255)
r = GetClassName(hwnd, sClassname, 255)
sClassname = Left(sClassname, r)
If Left$(sWindowText, 13) = "ProgName" And sClassname = "ProgName" Then
getUO = hwnd
Exit Function
End If
hwnd = GetWindow(hwnd, GW_HWNDNEXT)
Loop
End Function