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]:eek2:
Printable View
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]:eek2:
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
:wave:
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:
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 'and i think you would want SendMessgeByString 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
VB Code:
Function FindWindowLike(strPartOfCaption As String, Optional strChildwincap As String) As String Dim hwnd As Long Dim hWnd1 As Long Dim strCurrentWindowText As String Dim r As Long hwnd = GetForegroundWindow Do Until hwnd = 0 strCurrentWindowText = Space$(255) r = GetWindowText(hwnd, strCurrentWindowText, 255) strCurrentWindowText = Left$(strCurrentWindowText, r) 'hWnd = GetWindow(hWnd, GW_CHILD) If InStr(1, LCase(strCurrentWindowText), LCase(strPartOfCaption)) <> 0 Then GoTo Found hwnd = GetWindow(hwnd, GW_HWNDNEXT) Loop Exit Function Found: If strChildwincap = "" Then GoTo EN hWnd1 = hwnd Do Until hWnd1 = 0 hWnd1 = GetWindow(hWnd1, GW_CHILD) strCurrentWindowText = Space$(255) r = GetWindowText(hWnd1, strCurrentWindowText, 255) strCurrentWindowText = Left$(strCurrentWindowText, r) If InStr(1, LCase(strCurrentWindowText), LCase(strChildwincap)) <> 0 Then GoTo EN Loop EN: FindWindowLike = hwnd & " Æ " & hWnd1 End Function Then I Can Find MDI Child Window and I want to Send Key Strokes to the RICH TEXT BOX in that window How can I Do that thing ?
:confused: :confused: :confused: :wave: :wave: :eek2: :eek2: