谢谢

解决方案 »

  1.   

    EnumWindows枚举系统中的所有窗体,看看那个窗体的标题中包含你要的部分字符。要不然就直接用窗口的类名来找。
      

  2.   

    Function MyEnumCallBack (EnumHandle : HWnd; EnumValue : Integer) : Boolean; Stdcall;
    var
      lpBuf : Array [0..255] of char;
    begin
      Result := True;
      if (GetWindowText(EnumHandle,@lpBuf,255) > 0) //then
        and (GetWindowLong(EnumHandle, GWL_EXSTYLE or WS_EX_OVERLAPPEDWINDOW) <> 0 ) then
        begin
          if Pos('Unit1',StrPas(lpBuf)) > 0 then
          begin
            Form1.Memo1.Lines.add('Form Caption -- Form Handle');
            Form1.Memo1.Lines.add(lpBuf + ' -- ' + IntToStr(EnumHandle));
          end;
       end;
    end;procedure TForm1.Button1Click(Sender: TObject);
    begin
      EnumWindows(@MyEnumCallBack,0);
    end;
      

  3.   

    to Wnyu(西门吹水): 请问一下
    EnumWindows(@MyEnumCallBack, 0);//如果后面的0改为integer(self)有没有区别?欢迎到这里灌水:http://expert.csdn.net/Expert/topic/1521/1521364.xml?temp=.8649713
      

  4.   

    To:fancier(OP&&(C/C++)) 
    EnumWindows(@MyEnumCallBack,Integer(Self));是可以的,它只是作为一个参数被调用
    上面程序改一下为
    Function MyEnumCallBack (EnumHandle : HWnd; EnumValue : Integer) : Boolean; Stdcall;
    var
      lpBuf : Array [0..255] of char;
    begin
      Result := True;
      if (GetWindowText(EnumHandle,@lpBuf,255) > 0) //then
        and (GetWindowLong(EnumHandle, GWL_EXSTYLE or WS_EX_OVERLAPPEDWINDOW) <> 0 ) then
        begin
          if Pos('Unit1',StrPas(lpBuf)) > 0 then
          begin
            TForm(EnumValue).Caption := 'hello';
            Form1.Memo1.Lines.add('Form Caption -- Form Handle');
            Form1.Memo1.Lines.add(lpBuf + ' -- ' + IntToStr(EnumHandle));
          end;
       end;
    end;
    procedure TForm1.Button1Click(Sender: TObject);
    begin
      EnumWindows(@MyEnumCallBack,Integer(Self));end;