GetWindowThreadProcessId VB声明 
Declare Function GetWindowThreadProcessId Lib "user32" Alias "GetWindowThreadProcessId" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
 
说明 
获取与指定窗口关联在一起的一个进程和线程标识符 
返回值 
Long,拥有窗口的线程的标识符 
参数表 
参数 类型及说明 
lpdwProcessId Long,指定一个变量,用于装载拥有那个窗口的一个进程的标识符 
hwnd Long,指定窗口句柄 

解决方案 »

  1.   

    GetWindowThreadProcessIdThe GetWindowThreadProcessId function retrieves the identifier of the thread that created the specified window and, optionally, the identifier of the process that created the window. DWORD GetWindowThreadProcessId(
      HWND hWnd,             // handle to window
      LPDWORD lpdwProcessId  // address of variable for process identifier
    );
     
    Parameters
    hWnd 
    Handle to the window. 
    lpdwProcessId 
    Pointer to a 32-bit value that receives the process identifier. If this parameter is not NULL, GetWindowThreadProcessId copies the identifier of the process to the 32-bit value; otherwise, it does not. 
    Return Values
    The return value is the identifier of the thread that created the window. 
      

  2.   

    openprocess
    只支持win2000建议用WMI
      

  3.   

    openprocess
    只支持win2000
    瞎说,应该是OpenThread只支持2000