|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Sendmessage problem help!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 See inline
/claes "paraidy" <samore***@tiscali.it> wrote in message Declare Auto Function FindWindow Lib "user32.dll" (ByVal lpClassName As news:1153129104.098306.239270@75g2000cwc.googlegroups.com... > 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 String, ByVal lpWindowName As String) As IntPtr > Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" Declare Auto Function SendMessage Lib "user32.dll" (ByVal hwnd As IntPtr, > (ByVal hwnd As Int32, ByVal wMsg As Int32, ByVal wParam As Int32, ByRef > lParam As String) As Int32 ByVal wMsg As IntPtr, ByVal wParam As Int32, ByVal lParam As String) As Int32 > Declare Function FindWindowEx Lib "user32.dll" Alias Declare Auto Function FindWindowEx Lib "user32.dll" (ByVal hWnd1 As IntPtr, > "FindWindowExA" (ByVal hWnd1 As Int32, ByVal hWnd2 As Int32, ByVal > lpsz1 As String, ByVal lpsz2 As String) As Int32 ByVal hWnd2 As IntPtr, ByVal lpsz1 As String, ByVal lpsz2 As String) As IntPtr > Const WM_GETTEXT As Int32 = &HD Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As > 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 System.EventArgs) Handles Button10.Click Dim Handle As IntPtr Dim Handlex As IntPtr Handle = FindWindow("Notepad", Nothing) Handlex = FindWindowEx(Handle, 0, "EDIT", Nothing) SendMessage(Handlex, WM_SETTEXT, 0, ("Hello!!")) End Sub Great, it work, Thx a lot!, there is only a thing, why with Wordpad it
doesn't work? You need to change the class names:
Handle = FindWindow("WordPadClass", Nothing) Handlex = FindWindowEx(Handle, 0, "RICHEDIT50W", Nothing) /claes Show quoteHide quote "paraidy" <samore***@tiscali.it> wrote in message news:1153148358.177338.133000@p79g2000cwp.googlegroups.com... > Great, it work, Thx a lot!, there is only a thing, why with Wordpad it > doesn't work? > Claes Bergefall wrote:
> You need to change the class names: Thx a lot, you helped me a lot :)> > Handle = FindWindow("WordPadClass", Nothing) > Handlex = FindWindowEx(Handle, 0, "RICHEDIT50W", Nothing) > > /claes > > "paraidy" <samore***@tiscali.it> wrote in message > news:1153148358.177338.133000@p79g2000cwp.googlegroups.com... > > Great, it work, Thx a lot!, there is only a thing, why with Wordpad it > > doesn't work? > >
Bug or Feature? CancelButton vs Escape Key
overides/loads usage Problems using Me.Scale in Framework 2.0 ListView and ImageList/ImageKey An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in system.data.dll enforce event calling on inherited classes Holding down a key HELP: Problem Hosting the "Simplest" of VB.NET Apps detect if running on a terminal server Deleting files using wildcards |
|||||||||||||||||||||||