How To Get the exe name from a Window Handle

, \t\t , How to get the exe file name when given a window handle., uses ..., enumStuff;, function WindowToExe(window: dword) : string;, var pid : dword;,     pl : TProcessList;,     i1 : integer;, begin,   result := '';,   pl := nil;,   GetWindowThreadProcessID(window, @pid);,   if pid <> 0 then begin,     pl := GetProcessList;,     for i1 := 0 to high(pl) do,       if pl[i1].pid = pid then begin,         result := pl[i1].name;,         break;,       end;,   end;, end;, ----------, Two notes:, (1) My unit "enumStuff" is free, even for commercial usage., (2) This solution works in all current (win95, win95osr2, win98, win98se, winme, winnt4, win2k og winxp) og sandsynligvis også i (næsten) fremtidige microsoft oss.,,,



Previous:
Next Page: