mark 外挂基础
全局代码
<DllImport("user32.dll", EntryPoint := "FindWindow", SetLastError := True)> _
Public Function FindWindow(lpClassName As String, lpWindowName As String) As IntPtr
End Function
<DllImport("user32.dll", EntryPoint := "FindWindowEx", SetLastError := True)> _
Public Function FindWindowEx(hwndParent As IntPtr, hwndChildAfter As UInteger, lpszClass As String, lpszWindow As String) As IntPtr
End Function
<DllImport("user32.dll", EntryPoint := "SendMessage", SetLastError := True, CharSet := CharSet.Auto)> _
Public Function SendMessage(hwnd As IntPtr, wMsg As UInteger, wParam As IntPtr, lParam As String) As Integer
End Function
调用代码
Dim hwnd As IntPtr = FindWindow("WindowsForms10.Window.8.app.0.378734a", "提示")
If hwnd <> IntPtr.Zero Then
msgbox("即将修改窗口标题")
SendMessage(hwnd, &H000C, 0, "修改窗口的标题")
Dim hwndSure As IntPtr = FindWindowEx(hwnd, 0, "WindowsForms10.STATIC.app.0.378734a", "OpenQQ失去连接!")
If hwndSure <> IntPtr.Zero Then
msgbox("找到label:" & cstr(hwndSure))
'SendMessage(hwndSure, &H000C, 0, "我就修改你怎么啦!")
End If
End If