P
paraidy
Hi all, reading some examples in this group i'm trying to send a text
to notepad, but it doesn't work, can someone to correct my code? Thx
Private Declare Function FindWindow Lib "user32.dll" Alias
"FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As
String) As Long
Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA"
(ByVal hwnd As Int32, ByVal wMsg As Int32, ByVal wParam As Int32, ByRef
lParam As String) As Int32
Declare Function FindWindowEx Lib "user32.dll" Alias
"FindWindowExA" (ByVal hWnd1 As Int32, ByVal hWnd2 As Int32, ByVal
lpsz1 As String, ByVal lpsz2 As String) As Int32
Const WM_GETTEXT As Int32 = &HD
Const WM_GETTEXTLENGTH As Int32 = &HE
Const WM_SETTEXT As Int32 = &HC
Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button10.Click
Dim Handle As Long
Dim Handlex As Int32
Handle = FindWindow("Notepad", "")
Handlex = FindWindowEx(Handle, 0, "Edit", "")
SendMessage(Handlex, WM_SETTEXT, 0, ("Hello!!"))
End Sub
to notepad, but it doesn't work, can someone to correct my code? Thx
Private Declare Function FindWindow Lib "user32.dll" Alias
"FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As
String) As Long
Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA"
(ByVal hwnd As Int32, ByVal wMsg As Int32, ByVal wParam As Int32, ByRef
lParam As String) As Int32
Declare Function FindWindowEx Lib "user32.dll" Alias
"FindWindowExA" (ByVal hWnd1 As Int32, ByVal hWnd2 As Int32, ByVal
lpsz1 As String, ByVal lpsz2 As String) As Int32
Const WM_GETTEXT As Int32 = &HD
Const WM_GETTEXTLENGTH As Int32 = &HE
Const WM_SETTEXT As Int32 = &HC
Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button10.Click
Dim Handle As Long
Dim Handlex As Int32
Handle = FindWindow("Notepad", "")
Handlex = FindWindowEx(Handle, 0, "Edit", "")
SendMessage(Handlex, WM_SETTEXT, 0, ("Hello!!"))
End Sub