我要弄个SG喊话器.自己用的.但是用了API函数:findwindow.和GetWindowThreadProcessId 就是找不到SG的窗口句柄,
请高手告诉饿该怎么弄 :不要改动我的代码.在我的代码上进行修改,要是修改,请将我所有的错误地方改正过来,谢谢了:代码如下:Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
Private Sub Command1_Click()
Timer1.Enabled = True
Label5.Caption = "正在喊话中......"
End Sub
Private Sub Command2_Click()
Timer1.Enabled = False
Label5.Caption = "已经停止喊话......"
End Sub
Private Sub Option1_Click()
VB.Clipboard.Clear
VB.Clipboard.SetText Text1.Text
End Sub
Private Sub Option2_Click()
VB.Clipboard.Clear
VB.Clipboard.SetText Text2.Text
End Sub
Private Sub Timer1_Timer()
Timer1.Interval = Combo1.Text
Dim hwnd As Long
hwnd = FindWindow(vbNullString, "QQSG")
If hwnd <> 0 Then
Label5.Caption = "游戏正在运行中,可以进行喊话......"
SendKeys "{enter}"
SendKeys "{^v}"
SendKeys "{enter}"
End If
If hwnd = 0 Then
Label5.Caption = "没有检测到游戏运行,请检查后在启动......"
End If
End Sub