比如在QQgame上输入帐号密码点QQGame的登陆 怎么弄呢 类似的也行
解决方案 »
- 那位大牛会写关于AUTOCAD CAD2002 里面提取坐标的程序呢
- 如何移动picture控件
- vb改变编码问题?急啊!高手帮个忙,小弟不甚感激!
- VB中如何调用PB的DLL动态库?请问能这样调用吗?
- 使用Hook的时会出现2-3次消息队列,为什么?怎么解决?
- 讨论,软件行业的前途问题。。。
- 水晶报表打包?
- 急:请问怎样把"目录a"下的所有文件和目录拷贝到"目录b"下,其中"目录a"和"目录b"为字符串
- 春节大送分!
- 请问,ScaleTop,ScaleLeft,ScaleWidth,ScaleHeight和Top,Left,Width,Height的区别
- 使用Webbrowser问题
- 正则表达式的部件在哪下载?
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 LongPrivate Const WM_SETTEXT = &HCPrivate Sub Command1_Click()
Dim frmHwn As Long
Dim txtHwn As Long
Dim cmbHwn As Long '登录QQ游戏窗体句框
frmHwn = FindWindow(vbNullString, "登录QQ游戏")
If frmHwn <> 0 Then
'QQ号码框句框
cmbHwn = FindWindowEx(frmHwn, ByVal 0&, "ComboBox", vbNullString)
'QQ密码框句框
txtHwn = FindWindowEx(frmHwn, ByVal 0&, "Edit", vbNullString)
End If
'发送
If cmbHwn <> 0 Then SendMessage cmbHwn, WM_SETTEXT, 0, ByVal "57896985"
If txtHwn <> 0 Then SendMessage txtHwn, WM_SETTEXT, 0, ByVal "57896985"
End Sub
This project needs a ListBox, named List1 and a TextBox, named Text1
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Any) As Long
Const LB_FINDSTRING = &H18F
Private Sub Form_Load()
'KPD-Team 1998
'URL: http://www.allapi.net/
'E-Mail: [email protected]
'Add some items to the listbox
With List1
.AddItem "Computer"
.AddItem "Screen"
.AddItem "Modem"
.AddItem "Printer"
.AddItem "Scanner"
.AddItem "Sound Blaster"
.AddItem "Keyboard"
.AddItem "CD-Rom"
.AddItem "Mouse"
End With
End Sub
Private Sub Text1_Change()
'Retrieve the item's listindex
List1.ListIndex = SendMessage(List1.hwnd, LB_FINDSTRING, -1, ByVal CStr(Text1.Text))
End Sub
2.
Private Declare Function SendMessage Lib "User32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Sub ReleaseCapture Lib "User32" ()
Const WM_NCLBUTTONDOWN = &HA1
Const HTCAPTION = 2
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
'KPD-Team 1999
'URL: http://www.allapi.net/
'E-Mail: [email protected]
Dim lngReturnValue As Long
If Button = 1 Then
'Release capture
Call ReleaseCapture
'Send a 'left mouse button down on caption'-message to our form
lngReturnValue = SendMessage(Me.hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&)
End If
End Sub
Private Sub Form_Paint()
Me.Print "Click on the form, hold the mouse button and drag it"
End Sub
3.
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Long) As Long
Private Declare Function DefWindowProc Lib "user32" Alias "DefWindowProcA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Const WM_SETHOTKEY = &H32
Const WM_SHOWWINDOW = &H18
Const HK_SHIFTA = &H141 'Shift + A
Const HK_SHIFTB = &H142 'Shift + B
Const HK_CONTROLA = &H241 'Control + A
Const HK_ALTZ = &H45A
'The value of the key-combination has to
'declared in lowbyte/highbyte-format
'That means as a hex-number: the last two
'characters specify the lowbyte (e.g.: 41 = a),
'the first the highbyte (e.g.: 01 = 1 = Shift)
Private Sub Form_Load()
'KPD-Team 1999
'URL: http://www.allapi.net/
'E-Mail: [email protected]
Me.WindowState = vbMinimized
'Let windows know what hotkey you want for
'your app, setting of lParam has no effect
erg& = SendMessage(Me.hwnd, WM_SETHOTKEY, HK_ALTZ, 0)
'Check if succesfull
If erg& <> 1 Then
MsgBox "You need another hotkey", vbOKOnly, "Error"
End If
'Tell windows what it should do, when the hotkey
'is pressed -> show the window!
'The setting of wParam and lParam has no effect
erg& = DefWindowProc(Me.hwnd, WM_SHOWWINDOW, 0, 0)
End Sub上面是三个SendMessage例子,自己慢慢研究吧
Declare Function FindWindow Lib "user32" Alias _
"FindWindowA" (ByVal lpClassName as String, _
ByVal lpWindowName As Long) As Long
Declare Function SendMessage Lib "user32" Alias _
"SendMessageA" (ByVal hWnd as Long,ByVal wMsg as Long _
ByVal wParam as Long, _
ByVal lParam As Long) As Long
Sub GetExcel()
Dim MyXL As Object '用于存放'Microsoft Excel 引用的变量。
Dim ExcelWasNotRunning As Boolean '用于最后释放的标记。
'测试 Microsoft Excel 的副本是否在运行。
On Error Resume Next
'不带第一个参数调用 Getobject 函数将
'返回对该应用程序的实例的引用。
'如果该应用程序不在运行,则会产生错误。
Set MyXL = Getobject(, "Excel.Application")
If Err.Number <> 0 Then ExcelWasNotRunning = True
Err.Clear '如果发生错误则要清除 Err 对象。
'检测 Microsoft Excel。如果 Microsoft Excel 在运行,
'则将其加入运行对象表。
DetectExcel
'将对象变量设为对要看的文件的引用。
Set MyXL = Getobject("c:\vb6\MYTEST.XLS")
'设置其 Application 属性,显示 Microsoft Excel。
'然后使用 MyXL 对象引用的 Windows 集合
'显示包含该文件的实际窗口。
MyXL.Application.Visible = True
MyXL.Parent.Windows(1).Visible = True
'在此处对文件
'进行操作。
'如果在启动时,Microsoft Excel 的这份副本不在运行中,
'则使用 Application 属性的 Quit 方法来关闭它。
'注意,当试图退出 Microsoft Excel 时,
'标题栏会闪烁,并显示一条消息
'询问是否保存所加载的文件。
If ExcelWasNotRunning = True Then
MyXL.Application.Quit
End IF
Set MyXL = Nothing '释放对该应用程序和电子数据表的引用。
End Sub
Sub DetectExcel()
'该过程检测并登记正在运行的 Excel。
Const WM_USER = 1024
Dim hWnd As Long
'如果 Excel 在运行,则该 API 调用将返回其句柄。
hWnd = FindWindow("XLMAIN", 0)
If hWnd = 0 Then '0 表示没有 Excel 在运行。
Exit Sub
Else
'Excel 在运行,因此可以使用 SendMessage API
'函数将其放入运行对象表。
SendMessage hWnd, WM_USER + 18, 0, 0
End If
End Sub