|
-
Dec 7th, 2005, 07:28 PM
#1
Frenzied Member
Re: API Newbie
You misunderstood me on the 13 part. I meant, instead of using variablle WM_GETTEXT in one of the parameters, just put value 13.
make buffer = space(len) to buffer = " " make it 255 blank spaces.
-
Dec 8th, 2005, 09:47 AM
#2
Thread Starter
Frenzied Member
Re: API Newbie
Ok i hope i did this right, here is what i have, atleast it builds, but when i hit the button it dosent do anything":
VB Code:
Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Integer, ByVal hWnd2 As Integer, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As String) As Long
Public Sub proc()
Dim hwnd As Long
Dim hwndEx As Long
'gets handle of notepad
hwnd = FindWindow("Notepad", vbNullString)
'gets handle of 'edit' area of notepad
hwndEx = FindWindowEx(hwnd, vbNullString, "edit", vbNullString)
Dim x As Integer
x = 1
Dim buffer As String 'buffer will contain the text from notepad
buffer = " "
'sends WM_GETTEXT message to 'edit' area of notepad
Dim x As Integer
x = SendMessage(hwndEx, 13, buffer)
buffer = buffer.Substring(0, x)
Text1.Text = buffer
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
|