精华区 [关闭][返回]

当前位置:网易精华区>>讨论区精华>>编程开发>>C/C++>>技术精解:内存、进程、线程等>>有什么办法可以得到一个外部进程的句柄>>Re:有什么办法可以得到一个外部进程的句柄(2)

主题:Re:有什么办法可以得到一个外部进程的句柄(2)
发信人: alpha_fu()
整理人: wenbobo(2002-11-22 21:04:53), 站内信件
HWND FindWindow(
  LPCTSTR lpClassName,  // pointer to class name
  LPCTSTR lpWindowName  // pointer to window name
); 
用这个函数找到窗口
DWORD GetWindowThreadProcessId(
  HWND hWnd,             // handle to window
  LPDWORD lpdwProcessId  // address of variable for process identifier
);
用这个函数找到PID
HANDLE OpenProcess(
  DWORD dwDesiredAccess,  // access flag
  BOOL bInheritHandle,    // handle inheritance flag
  DWORD dwProcessId       // process identifier
);
用这个函数得到handle 

[关闭][返回]