Hello,
I try to read the content of an open Notepad window, but I don't get WM_GETTEXT to work with Visual Basic .NET. I have the correct handle for the Notepad window and get the number of signs with wm_gettextlengt h, but no results for wm_gettext.
Here is how I try it:
Private Declare Function SendMessage Lib "user32" Alias "SendMessag eA" (ByVal hWnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As Object, ByVal lParam As Object) As Integer
Public Const WM_GETTEXT = &HD
Public Const WM_GETTEXTLENGT H = &HE
dim length, NotepadResult as String
length = SendMessage(han dle2, WM_GETTEXTLENGT H, Nothing, 0)
SendMessage(han dle2, WM_GETTEXT, length, NotepadResult)
Anyone knows how to get this to work?
Thanks in advance for any help!
Regards
Sebastian
I try to read the content of an open Notepad window, but I don't get WM_GETTEXT to work with Visual Basic .NET. I have the correct handle for the Notepad window and get the number of signs with wm_gettextlengt h, but no results for wm_gettext.
Here is how I try it:
Private Declare Function SendMessage Lib "user32" Alias "SendMessag eA" (ByVal hWnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As Object, ByVal lParam As Object) As Integer
Public Const WM_GETTEXT = &HD
Public Const WM_GETTEXTLENGT H = &HE
dim length, NotepadResult as String
length = SendMessage(han dle2, WM_GETTEXTLENGT H, Nothing, 0)
SendMessage(han dle2, WM_GETTEXT, length, NotepadResult)
Anyone knows how to get this to work?
Thanks in advance for any help!
Regards
Sebastian
Comment