View Poll Results: Do you know answer for my problem

Voters
1. You may not vote on this poll
  • Yes

    1 100.00%
  • No

    0 0%
Results 1 to 4 of 4

Thread: How to SendMessage to MDI Child Form

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2004
    Location
    Sri Lanka
    Posts
    2

    Question How to SendMessage to MDI Child Form

    Do you know how to find hwnd of control in MDI child form by using API calls and

    How sendmessage or postmessage or sendkeys to that control in child window.

    I tried it but, I couldn't do it.



    [COLOR=red]
    Sandun is the BEST

  2. #2
    Frenzied Member ice_531's Avatar
    Join Date
    Aug 2002
    Location
    Sitting w/ Bob Status: -Next -To- Null- Friend: Philip
    Posts
    1,152
    I see you haven't posted much. So Welcome to VBForums

    Try placing this in the API forum though....and if you search there you should find an answer if not i'll post an example.


    ice
    :::`DISCLAIMER`:::
    Do NOT take anything i have posted to be truthful in any way, shape or form.
    Thank You!

    --------------------------------
    "Never heard about "hiking" poles. I usualy just grab a stick from the nature, and use that as a pole." - NoteMe
    "Finaly I can look as gay as I want..." - NoteMe
    Languages: VB6, BASIC, Java, C#. C++

  3. #3
    Fanatic Member ALL's Avatar
    Join Date
    Jul 2004
    Location
    192.168.1.1
    Posts
    711
    yes, i want to welcome u too.

    you should play around the forum test area before officaly posting

    and for your question, you should use the FindWindowEX:
    VB Code:
    1. Public Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
    2. 'and i think you would want SendMessgeByString
    3. Public Declare Function SendMessageByString Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
    Last edited by ALL; Jul 20th, 2004 at 07:53 PM.
    Please support one of my projects?
    TKForums.com

    Web Forum
    JavaScript Wiki
    ________________________
    If somone helps you, please rate their post, by clicking the to rate their post

  4. #4

    Thread Starter
    New Member
    Join Date
    Feb 2004
    Location
    Sri Lanka
    Posts
    2

    Question ThanX !

    VB Code:
    1. Function FindWindowLike(strPartOfCaption As String, Optional strChildwincap As String) As String
    2. Dim hwnd As Long
    3. Dim hWnd1 As Long
    4. Dim strCurrentWindowText As String
    5. Dim r As Long
    6.  
    7. hwnd = GetForegroundWindow
    8.  
    9. Do Until hwnd = 0
    10.         strCurrentWindowText = Space$(255)
    11.         r = GetWindowText(hwnd, strCurrentWindowText, 255)
    12.         strCurrentWindowText = Left$(strCurrentWindowText, r)
    13.         'hWnd = GetWindow(hWnd, GW_CHILD)
    14.         If InStr(1, LCase(strCurrentWindowText), LCase(strPartOfCaption)) <> 0 Then GoTo Found
    15.         hwnd = GetWindow(hwnd, GW_HWNDNEXT)
    16. Loop
    17.  
    18. Exit Function
    19. Found:
    20.  
    21. If strChildwincap = "" Then GoTo EN
    22.  
    23. hWnd1 = hwnd
    24. Do Until hWnd1 = 0
    25.         hWnd1 = GetWindow(hWnd1, GW_CHILD)
    26.         strCurrentWindowText = Space$(255)
    27.         r = GetWindowText(hWnd1, strCurrentWindowText, 255)
    28.         strCurrentWindowText = Left$(strCurrentWindowText, r)
    29.         If InStr(1, LCase(strCurrentWindowText), LCase(strChildwincap)) <> 0 Then GoTo EN
    30. Loop
    31.  
    32.  
    33. EN:
    34. FindWindowLike = hwnd & " Æ " & hWnd1
    35. End Function
    36.  
    37.  
    38.  
    39.  
    40. Then I Can Find MDI Child Window and I want to Send Key Strokes to the RICH TEXT BOX in that window
    41.  
    42. How can I Do that thing ?

    Sandun is the BEST

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