Public Class Form1
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 Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Integer) As Long
Public Declare Function SendMessageCallback Lib "user32" Alias "SendMessageCallbackA" (ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, lParam As String, ByVal lpResultCallBack As Long, ByVal dwData As Long) As Long
Private Const WM_CHAR = &H102
Private Const WM_SETTEXT = &HC
Private Const WM_GETTEXT = &HD
Private Const VK_RETURN = &HD
Private Const LB_ADDSTRING = &H180
Private Const LB_INSERTSTRING = &H181
Private Const LB_DELETESTRING = &H182
Private Const LB_SELITEMRANGEEX = &H183
Private Const LB_RESETCONTENT = &H184
Private Const LB_SETSEL = &H185
Private Const LB_SETCURSEL = &H186
Private Const LB_GETSEL = &H187
Private Const LB_GETCURSEL = &H188
Private Const LB_GETTEXT = &H189
Private Const LB_GETTEXTLEN = &H18A
Private Const LB_GETCOUNT = &H18B
Private Const LB_SELECTSTRING = &H18C
Private Const LB_DIR = &H18D
Private Const LB_GETTOPINDEX = &H18E
Private Const LB_FINDSTRING = &H18F
Private Const LB_GETSELCOUNT = &H190
Private Const LB_GETSELITEMS = &H191
Private Const LB_SETTABSTOPS = &H192
Private Const LB_GETHORIZONTALEXTENT = &H193
Private Const LB_SETHORIZONTALEXTENT = &H194
Private Const LB_SETCOLUMNWIDTH = &H195
Private Const LB_ADDFILE = &H196
Private Const LB_SETTOPINDEX = &H197
Private Const LB_GETITEMRECT = &H198
Private Const LB_GETITEMDATA = &H199
Private Const LB_SETITEMDATA = &H19A
Private Const LB_SELITEMRANGE = &H19B
Private Const LB_SETANCHORINDEX = &H19C
Private Const LB_GETANCHORINDEX = &H19D
Private Const LB_SETCARETINDEX = &H19E
Private Const LB_GETCARETINDEX = &H19F
Private Const LB_SETITEMHEIGHT = &H1A0
Private Const LB_GETITEMHEIGHT = &H1A1
Private Const LB_FINDSTRINGEXACT = &H1A2
Private Const LB_SETLOCALE = &H1A5
Private Const LB_GETLOCALE = &H1A6
Private Const LB_SETCOUNT = &H1A7
Private Const CB_GETLBTEXT = &H148
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.Text = "asd"
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim hwnd As Long, wnd As Long, wnd2 As Long, st As String
'Me.TextBox1.Text =
FindForm().Text = "zxc"
st = Space(99)
Dim V$ = Space(16)
MsgBox("$" + st + "$")
hwnd = FindWindow(vbNullString, "Прога")
MsgBox(hwnd.ToString)
GetClassName(529602, st, 10)
'wnd = FindWindowEx(hwnd, 0&, "Afx:00400000:8:00000000:011000A8:00000000", vbNullString) 'получаем hwnd текстбокса блокнота
wnd = FindWindowEx(hwnd, 0&, vbNullString, vbNullString) 'получаем hwnd текстбокса блокнота
'MsgBox(wnd.ToString)
'wnd2 = FindWindowEx(wnd, 0, "Afx:00400000:0:00010005:00000000:00000000", vbNullString) 'получаем hwnd текстбокса блокнота
wnd2 = FindWindowEx(wnd, 0, vbNullString, vbNullString) 'получаем hwnd текстбокса блокнота
'MsgBox(wnd.ToString)
'wnd2 = FindWindowEx(wnd, wnd2, "Afx:00400000:0:00010005:00000000:00000000", vbNullString) 'получаем hwnd текстбокса блокнота
wnd2 = FindWindowEx(wnd, wnd2, vbNullString, vbNullString) 'получаем hwnd текстбокса блокнота
'MsgBox(wnd.ToString)
'wnd = FindWindowEx(wnd, wnd2, "Afx:00400000:0:00010005:00000000:00000000", vbNullString) 'получаем hwnd текстбокса блокнота
wnd = FindWindowEx(wnd, wnd2, vbNullString, vbNullString) 'получаем hwnd текстбокса блокнота
'MsgBox(wnd.ToString)
'wnd = FindWindowEx(wnd, 0&, "AfxFrameOrView70", vbNullString) 'получаем hwnd текстбокса блокнота
wnd = FindWindowEx(wnd, 0&, vbNullString, vbNullString) 'получаем hwnd текстбокса блокнота
'MsgBox(wnd.ToString)
'wnd = FindWindowEx(wnd, 0&, "ListBox", vbNullString) 'получаем hwnd текстбокса блокнота
wnd = FindWindowEx(wnd, 0&, vbNullString, vbNullString) 'получаем hwnd текстбокса блокнота
'MsgBox(wnd.ToString)
'wnd = 529602
Call GetClassName(wnd, st, 99)
'TextBox1.Text = st
'Call SendMessage(wnd, WM_SETTEXT, 0, "Test2")
'MsgBox(LB_FINDSTRING)
'MsgBox(SendMessage(TextBox1.Text, LB_GETTEXT, 1, V))
MsgBox("Len13=" + CStr(SendMessage(wnd, LB_GETTEXTLEN, 13, 0)))
MsgBox("Len14=" + CStr(SendMessage(wnd, LB_GETTEXTLEN, 14, 0)))
MsgBox("Len15=" + CStr(SendMessage(wnd, LB_GETTEXTLEN, 15, 0)))
MsgBox(SendMessage(wnd, LB_GETTEXT, 13, V))
'MsgBox(SendMessageCallback(463934, LB_GETTEXT, 1, V, 0, 0))
'MsgBox(SendMessage(wnd, LB_SELECTSTRING, 0, "DRM"))
MsgBox(Len(V))
RichTextBox1.Text = V
MsgBox("$" + V + "$")
'Call SendMessage(wnd, EM_SETSEL, 6, "") 'сдвигаем курсор на 6 знаков
'Call SendMessage(wnd, WM_CHAR, VK_RETURN, vbNullString) 'нажимаем Enter
End Sub
Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged
End Sub
End Class
|