g18c:VB中关于openprocess的问题

来源:百度文库 编辑:查人人中国名人网 时间:2024/04/29 20:22:20
请教个关于OpenProcess的问题,在VB下的。。。
我的声明如下Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
代码是:
Private Sub Form_Load()
WindowHandle = FindWindow(vbNullString, "PSO for PC")
If WindowHandle = 0 Then
Label3.Caption = "游戏未启动"
Else
Label3.Caption = "游戏已启动"
End If
GetWindowThreadProcessId WindowHandle, ProcessId
ProcessHandle = OpenProcess(PROCESS_ALL_ACCESS, False, ProcessId)
End Sub
我在另外一个窗口用print显示ProcessHandle是0,这是怎么回事,有人能解释一下吗

VB,VB.NET交流
欢迎假如24885035群,请说明意图
代码成就天地人生,程序造就你我辉煌
让我们在程序的路上一起走得更远!