http://blog.csdn.net/diligentcatrich/article/details/6250204DELPHI gets process handle through window handle or window captionTags: delphiaccess2011-03-15 11:02 1205 people read comments (0) favorite reports Classification:Delphi (251)
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
DELPHI through window handle or window caption get process handle May 08, 2009 Friday 10:15
Procedure Tform1.button1click (Sender:tobject); Var Hwindow:hwnd; {form Handle} Dwprocessid:dword; {Process ID} Hprocess:thandle; {Process Handle} Begin {Gets the handle of the form according to the caption} Hwindow: = FindWindow (nil, ' title ');
{Get process ID through form handle} GetWindowThreadProcessId (Hwindow, Dwprocessid);
{Get process handle through process ID} Hprocess: = OpenProcess (Process_all_access, False, Dwprocessid);
{End the process} TerminateProcess (hprocess, 0); End |
DELPHI gets process handle through window handle or window caption