注册 登录
编程论坛 VB6论坛

GetWindowThreadProcessId的一些问题

diejianwu 发布于 2013-01-27 15:06, 587 次点击
先看代码
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 Form_Click()
      
Dim a As Long

Dim b As Long
      
a = FindWindow(vbNullString, "计算器")  '获得窗口句柄

b = GetWindowThreadProcessId(a, vbNull) '获得进程PID

Print a

Print CStr(b)

End Sub
b的值和任务管理器的PID值不一样?  不管是 什么程序  都不一样? 怎么回事,  360  什么的都关了 就开一个VB 。。

1 回复
#2
bczgvip2013-02-01 18:22
Dim b As Long
dim c as long
a = FindWindow(vbNullString, "计算器")  '获得窗口句柄

b = GetWindowThreadProcessId(a, c) '获得进程PID 话说这没出错?

1