关于findwindow和getwindowthreadprocessid的问题!

gspgsp 2008-07-19 08:06:41
我的代码


Option Explicit

FindWindow

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

GetWindowThreadProcessId

Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long)
As Long



Dim hwnd As Long
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 Timer1_Timer()
Dim hwnd As Long ' 储存 FindWindow 函数返回的句柄
hwnd = FindWindow(vbNullString, "NavyFIELD") ' 取得进程标识符
'只要把Windows Media Player换成游戏的名称就可了!
If hwnd = 0 Then
Label1.Caption = "游戏未运行"
Else
Label1.Caption = "游戏已运行"
End If
End Sub

End Sub

总是提示无效外部过程 我刚学 自己找了一晚上也没找到问题在哪里 请懂得前辈帮忙看看 不胜感激!
...全文
165 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
happy_sea 2008-07-19
  • 打赏
  • 举报
回复
Option Explicit

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 Timer1_Timer()
Dim hwnd As Long ' 储存 FindWindow 函数返回的句柄
hwnd = FindWindow(vbNullString, "NavyFIELD") ' 取得进程标识符
'只要把Windows Media Player换成游戏的名称就可了!
If hwnd = 0 Then
Label1.Caption = "游戏未运行"
Else
Label1.Caption = "游戏已运行"
End If
End Sub
gspgsp 2008-07-19
  • 打赏
  • 举报
回复
呵呵 听楼上的 学基础去了 谢谢开心海!
happy_sea 2008-07-19
  • 打赏
  • 举报
回复
是啊,楼主应该把找这个错误的一晚上时间用在基础知识的学习上。
嗷嗷叫的老马 2008-07-19
  • 打赏
  • 举报
回复
晕.............现在一上手就做外挂的基础也太差了吧

1,488

社区成员

发帖
与我相关
我的任务
社区描述
VB API
社区管理员
  • API
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧