delphi QQ 채팅창 실례 캡처

2100 단어 Delphi
function EnumWindowsProc(hwnd: HWND; lParam: LPARAM): Boolean ;stdcall;
// EnumWindows           :
// function EnumWindowsProc(
// hwnd: HWND;    {       }
// lParam: LPARAM   {EnumWindows      ;       ,    ,          }
// ): Boolean; stdcall; {     False  ,      EnumWindows          False}
function EnumWindowsProc(hwnd: HWND; lParam: LPARAM): Boolean ;stdcall;
var
  WindowText    : string  ;       //     
  WindowClass   : string  ;       //     
  SendHwnd      : DWORD   ;       //     
  tdiahandle    : THandle ;
  tedithandle   : THandle ;
  tduihuakhandle: THandle ;
 begin
  if ( IsWindowVisible(hwnd) or IsIconic(hwnd) ) and
       (
        (GetWindowLong(hwnd, GWL_HWNDPARENT) = 0) or
        (GetWindowLong(hwnd, GWL_HWNDPARENT) = Longint(GetDesktopWindow))
       ) and
     ( GetWindowLong(hwnd, GWL_EXSTYLE) and WS_EX_TOOLWINDOW = 0)  then
  begin
   {-----    ------}
    SetLength(WindowText, GetWindowTextLength(hwnd)+2);
    Getwindowtext(hwnd, Pchar(WindowText), GetWindowTextLength(hwnd)+2);
    WindowText := string(Pchar(WindowText));

    {-----    ------}
    SetLength(WindowClass, 512);
    GetClassName(hwnd, Pchar(WindowClass), 512);
    WindowClass := string(Pchar(WindowClass) );
    if SameStr(WindowClass , 'TXGuiFoundation') then
    begin
      Form1.mmo.Lines.Add('     :' + WindowText +
                          '     : ' + WindowClass);
      BringWindowToTop(hwnd);
      SetWndText(hwnd,'hello,delphi test');
//      tduihuakhandle := GetDlgItem(hwnd, 0);
//      SendMessage()
//      SendHwnd := FindWindowEx(hwnd , 0, nil, '  (S)');   //       ,
//      ShowMessage(string(SendHwnd));
    end;
  end;
  Result := True;
 end;
procedure TForm1.btn1Click(Sender: TObject);
begin
   Form1.mmo.Clear;
// EnumWindows             
// function EnumWindows(
// lpEnumFunc: TFNWndEnumProc; {      }
// lParam: LPARAM       {        ,              }
// ): BOOL; stdcall; //    ,                  
   EnumWindows(@EnumWindowsProc ,0);
   FQQMessage := edtQQMessage.Text;
end;

좋은 웹페이지 즐겨찾기