|
-
Apr 18th, 2012, 10:33 AM
#1
Thread Starter
New Member
How to - Find Handle of each Rich Text Box on a form
Hello All,
Hope you can help?
I am trying to pass text from one form to another. On the target form I have two RichTextBoxes ( named RichTextBox1 and RichTextBox2 ). Now I can pass text ok to one of them ( I guess the first in the handle list ) but don't know how to specify each one individually. Do you know what I need to do?
Code below, thanks,
Public Declare Function SendMessageString Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Any) As Long
Public Const WM_SETTEXT = &HC
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
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Sub Command1_Click()
lhWnd = FindWindow(vbNullString, "Form2")
lhWnd = FindWindowEx(lhWnd, 0, "RichTextWndClass", vbNullString)
SendMessageString lhWnd, WM_SETTEXT, 0, Text1.Text
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|