Results 1 to 3 of 3

Thread: Get control handels

  1. #1
    WorkHorse
    Guest

    Get control handels

    How do I get the handels of the controls in a Outlook reply message window? I get the handle to the Reply window using FindWindowA. I'm trying to use FindWindowExA to get the handle for the box that hold the body of the message, but I can't work out how to get the child handles.

  2. #2
    jim mcnamara
    Guest
    EnumChildWindows using the hWnd of the container object (frame, form or pic box)
    Code:
    'in a form
    Private Sub Form_Load()
        'KPD-Team 2000
        'URL: http://www.allapi.net/
        'E-Mail: [email protected]
        Me.AutoRedraw = True
        EnumChildWindows GetDesktopWindow, AddressOf EnumChildProc, ByVal 0&
    End Sub
    'in a module
    Declare Function GetDesktopWindow Lib "user32" () As Long
    Declare Function EnumChildWindows Lib "user32" (ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
    Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
    Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
    Public Function EnumChildProc(ByVal hwnd As Long, ByVal lParam As Long) As Long
        Dim sSave As String
        'Get the windowtext length
        sSave = Space$(GetWindowTextLength(hwnd) + 1)
        'get the window text
        GetWindowText hwnd, sSave, Len(sSave)
        'remove the last Chr$(0)
        sSave = Left$(sSave, Len(sSave) - 1)
        If sSave <> "" Then Form1.Print sSave
        'continue enumeration
        EnumChildProc = 1
    End Function

  3. #3
    WorkHorse
    Guest
    Ooooh. I don't get it (sorry, I'm new at this). This gives me junk about my own app. I want the junk for the handle I send. Say I have a variable hEMAIL (and Outlook reply window) and I want to get the boxes for that (the body box). I'm sorry, I don't quite have a handle on all this but I just want to get to one box to put in some text. Please help a beginner. Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width