All pastes #592540 Raw Edit

Anonymous

public text v1 · immutable
#592540 ·published 2007-06-27 20:24 UTC
rendered paste body
#Compile Exe
#Include "WIN32API.INC"
Global returnedhandle As Dword, cid1 As Dword, cid2 As Dword
'// To determine if a hwnd is visible:
'IF IsWindowVisible(hWnd) = 1 THEN 'Window is visible

'// To determine the Process ID of a window:
'IF GetWindowThreadProcessId(hWnd,lProc) THEN MSGBOX "Process ID=" & STR$(lProc)

Function ParentCallback (ByVal hWndChild As Long, lRaram As Long) As Long
Dim szClass As Asciiz * %MAX_PATH
Dim szText  As Asciiz * %MAX_PATH
Dim lRes                As Long
lRes = GetClassName(hWndChild, szClass, SizeOf(szClass))
lRes = GetWindowText(hWndChild, szText, SizeOf(szText))
'STDOUT "  Child: Class=" & szClass & " " & "Text=" & szText
If sztext = "Intellisync for Intranets.com" Then
  Print "found"
  rst??? = getdlgitem(hWndChild, 1040)
    Print rst???
    If rst??? Then
      Print "triggering"
      sendMessage(hWndChild,%WM_COMMAND,1,0)
    End If
End If
lRes = EnumChildWindows(hWndChild, CodePtr(ChildCallback), 0&)
Function = 1
End Function

Function ChildCallback (ByVal hWndChild As Long, lRaram As Long) As Long
Dim szClass As Asciiz * %MAX_PATH
Dim szText  As Asciiz * %MAX_PATH
Dim lRes                As Long
lRes = GetClassName(hWndChild, szClass, SizeOf(szClass))
lRes = GetWindowText(hWndChild, szText, SizeOf(szText))
'STDOUT "PARENT: Class=" & szClass & " " & "Text=" & szText
Function = 1
End Function

Function PBMain As Long
On Error Resume Next
StdOut "Enumerating all parent and child windows..."
  Dim bResult As Long
  Do
  bResult = EnumChildWindows(GetDesktopWindow, CodePtr(ParentCallback), 0&)
  Sleep 50
  Loop
End Function