VB 中的openprocess

love5207070 2009-02-23 10:19:34
Private Sub Command1_Click()
Dim hwnd As Long
Dim pid As Long
Dim pro As Long
hwnd = FindWindow(vbNullString, "与 郑松 交谈中")
If hwnd = 0 Then
MsgBox ("没有找到该窗口")
Exit Sub
End If
GetWindowThreadProcessId hwnd, pid
MsgBox (pid)
pro = OpenProcess(process_all_access, False, pid)
MsgBox (pro)
End Sub

大家帮我看看,窗口打开也读到了进程,可是当我MsgBox (pro)的时候却读出来的是0?怎么会呢...
...全文
280 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
cih2000zg 2009-02-25
  • 打赏
  • 举报
回复

Private Sub Command1_Click()
Dim hwnd As Long
Dim pid As Long
Dim pro As Long
hwnd = FindWindow(vbNullString, "与 郑松 交谈中")
If hwnd = 0 Then
MsgBox ("没有找到该窗口")
Exit Sub
End If
GetWindowThreadProcessId hwnd, pid
MsgBox (pid)
pro = OpenProcess(1, False, pid) '把参数0改成1
MsgBox (pro)
End Sub

PROCESS_ALL_ACCESS
Specifies all possible access flags for the process object.
PROCESS_CREATE_PROCESS
Used internally.
PROCESS_CREATE_THREAD
Enables using the process handle in the CreateRemoteThread function to create a thread in the process.
PROCESS_DUP_HANDLE
Enables using the process handle as either the source or target process in the DuplicateHandle function to duplicate a handle.
PROCESS_QUERY_INFORMATION
Enables using the process handle in the GetExitCodeProcess and GetPriorityClass functions to read information from the process object.
PROCESS_SET_QUOTA
Enables using the process handle in the AssignProcessToJobObject and SetProcessWorkingSetSize functions to set memory limits.
PROCESS_SET_INFORMATION
Enables using the process handle in the SetPriorityClass function to set the priority class of the process.
PROCESS_TERMINATE
Enables using the process handle in the TerminateProcess function to terminate the process.
PROCESS_VM_OPERATION
Enables using the process handle in the VirtualProtectEx and WriteProcessMemory functions to modify the virtual memory of the process.
PROCESS_VM_READ
Enables using the process handle in the ReadProcessMemory function to read from the virtual memory of the process.
PROCESS_VM_WRITE
Enables using the process handle in the WriteProcessMemory function to write to the virtual memory of the process.
SYNCHRONIZE
Windows NT/2000: Enables using the process handle in any of the wait functions to wait for the process to terminate.
bob008 2009-02-24
  • 打赏
  • 举报
回复
又一个研究盗取QQ号的。。。 呵呵。。。
嗷嗷叫的老马 2009-02-23
  • 打赏
  • 举报
回复
一是要提权.......试一下.

二嘛........如果你的目标是QQ,那肯定人家有保护,当然不会这么容易就让你给OPEN了......

1,488

社区成员

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

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