想得到外部运行程序上状态栏的文字,
如何得到所需要的句柄?能否附上相应代码?

解决方案 »

  1.   

    获得所有进程
    procedure TForm1.Button1Click(Sender: TObject);
    var
      lppe: TProcessEntry32;
      found : boolean;
      Hand : THandle;
    begin
      Hand := CreateToolhelp32Snapshot(TH32CS_SNAPALL,0);
      found := Process32First(Hand,lppe);
      while found do
        begin
          ListBox1.Items.Add(StrPas(lppe.szExeFile));
          found := Process32Next(Hand,lppe);
        end;
    end;获得系统运行的进程名
    procedure TForm1.Button2Click(Sender: TObject);
    var
      hCurrentWindow:HWnd;
      szText:array[0..254] of char;
    begin
      hCurrentWindow:=Getwindow(handle,GW_HWNDFIRST);
      while hCurrentWindow <> 0 do
        begin
          if Getwindowtext(hcurrentwindow,@sztext,255)>0 then
            listbox2.items.add(strpas(@sztext));
          hCurrentWindow:=Getwindow(hCurrentwindow,GW_HWndNext);
        end;
    end;
      

  2.   

    多谢yuhouyangguang(雨后阳光) :
       你可能还没有完全理解我的意思,我希望:
       1,得到窗口的句柄;
       2,得到状态条的句柄;
       3,得到状态条上某一个StatusPanel的文本。
       现在我已经解决1和2,但是解决不了3,请再赐教。
      还有,我能够得到窗口上TButton,TPanel上面的文本,但是不能获得TLable上的文本,请问为什么?
       我想做的是:获得外部运行程序状态条第一栏(panels[0])的文本信息,且我不知道程序用哪种语言开发。