如题!

解决方案 »

  1.   

    用EnumWindows枚举再判断是否满足条件
      

  2.   

    看看这个
    http://www.newhua.com/soft/15963.htm
      

  3.   

    你可以用MS VS6.0 Tools 里面SPY++获取窗口句柄,并发现类名和窗口标题。
      

  4.   

    枚举窗口句柄,然后用API函数判断句柄的进程……DWORD GetWindowThreadProcessId(
      HWND hWnd,             // handle to window
      LPDWORD lpdwProcessId  // process identifier
    );
      

  5.   

    type
      TWndInfRec = record
        Wnd: HWND;
        Caption: string;
        Handle: string[8];
        ClassName: string;
        Rect: string[51];
        Owner: HWND;
        ProcessID: string[8];
        ThreadID: string[8];
      end;// 获得句柄的相关信息
    function GetWindowInformation(Wnd: HWND; var WndInfRec: TWndInfRec): Boolean;
    var
      Buf           : array [0..255] of Char;
      R             : TRect;
      ThreadID,
      ProcessID     : DWORD;
    begin
      Result := False;
      if Wnd = 0 then Exit;
      WndInfRec.Handle := IntToHex(Wnd, 8);
      if GetWindowText(Wnd, Buf, sizeof(Buf)) = 0 then Exit;
      WndInfRec.Caption := Buf;
      if GetClassName(Wnd, Buf, sizeof(Buf))= 0 then Exit;
      WndInfRec.ClassName := Buf;
      if not GetWindowRect(Wnd, R) then Exit;
      WndInfRec.Rect := format('(%d,%d)-(%d,%d) %dx%d',
        [R.left, R.top, R.right, R.bottom, R.right - R.left, R.bottom - R.top]);
      WndInfRec.Owner := GetWindow(Wnd, GW_OWNER);  ThreadID := GetWindowThreadProcessId(Wnd, ProcessId);  WndInfRec.ProcessID := IntToStr(ProcessId);
      WndInfRec.ThreadID := IntToStr(ThreadId);{  BOOL GetGUIThreadInfo(
      DWORD idThread,       // thread identifier
      LPGUITHREADINFO lpgui  // thread information
    );}end;function GetApplicationWindow(ParentWnd: HWND; Pt: TPoint): HWND;
    var
      R: TRect;
    begin
      Result := GetWindow(ParentWnd, GW_CHILD); // 取得第一個子視窗
      while Result <> 0 do
      begin
        GetWindowRect(Result, R); // 取得視窗矩形區域
        if IsWindowVisible(Result) and PtInRect(R, Pt) then
        begin
          if Result = frmWndExplorer.Form.Handle then // 忽略程式的 Main Form
          begin
            Result := 0;
            Exit;
          end;
          Exit;
        end;
        Result := GetWindow(Result, GW_HWNDNEXT); // 取得下一個 siblings 視窗
      end;
      Result := ParentWnd; // 找不到, 它就是我們要找的
    end;