我的执行文件名是wlgl.exe,窗口名叫“。。管理”
我不想通过窗口名得到句柄,只想用运行的文件名,怎么得到???

解决方案 »

  1.   

    var
      h:Hwnd;
    begin
      h := FindWindow(nil, '。。管理');
      if h <> 0 then 
      begin
        //找到了;
      end;
    end;
      

  2.   

    谢谢你的建议
    但我想得到“wlgl.exe”这个东西,要怎么办呢
      

  3.   

    取到句柄后,这样:
    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;
      

  4.   

    要uses
      enumStuff;
    在这下:
    http://www.madshi.net/enumStuff.zip