P pyc2001 Unregistered / Unconfirmed GUEST, unregistred user! 2005-05-16 #1 由一个程序的ProcessID号得到程序主窗口的句柄
P pyc2001 Unregistered / Unconfirmed GUEST, unregistred user! 2005-05-16 #2 由一个程序的ProcessID号得到程序主窗口的句柄
P plzw Unregistered / Unconfirmed GUEST, unregistred user! 2005-05-16 #3 呵呵,给你一段代码,该代码是叮叮当当写的。 <br>function GetHWNDofProcess(ProcessId: DWORD): HWND;<br> function _EnumWindowsProc(P_HWND: Cardinal; lParam: Cardinal): Boolean; stdcall;<br> var<br> PID: DWORD;<br> begin<br> GetWindowThreadProcessId(P_HWND, @PID);<br> if PCardinal(lParam)^ <> PID then<br> Result := True<br> else<br> begin<br> Result := False;<br> PCardinal(lParam+4)^ := P_HWND;<br> end;<br> end;<br><br>var<br> Buffer: array[0..1] of Cardinal;<br>begin<br> Result := 0;<br> Buffer[0] := ProcessId;<br> Buffer[1] := 0;<br> EnumWindows(@_EnumWindowsProc, Integer(@Buffer));<br> if Buffer[1] > 0 then Result := Buffer[1];<br>end;
呵呵,给你一段代码,该代码是叮叮当当写的。 <br>function GetHWNDofProcess(ProcessId: DWORD): HWND;<br> function _EnumWindowsProc(P_HWND: Cardinal; lParam: Cardinal): Boolean; stdcall;<br> var<br> PID: DWORD;<br> begin<br> GetWindowThreadProcessId(P_HWND, @PID);<br> if PCardinal(lParam)^ <> PID then<br> Result := True<br> else<br> begin<br> Result := False;<br> PCardinal(lParam+4)^ := P_HWND;<br> end;<br> end;<br><br>var<br> Buffer: array[0..1] of Cardinal;<br>begin<br> Result := 0;<br> Buffer[0] := ProcessId;<br> Buffer[1] := 0;<br> EnumWindows(@_EnumWindowsProc, Integer(@Buffer));<br> if Buffer[1] > 0 then Result := Buffer[1];<br>end;