Einzelnen Beitrag anzeigen

Benutzerbild von toms
toms
(CodeLib-Manager)

Registriert seit: 10. Jun 2002
4.648 Beiträge
 
Delphi XE Professional
 
#61

Re: Senden Von Strings an andere Programme

  Alt 11. Feb 2008, 11:04
Zitat von Maddin1:
Zitat:
Es handelt sich auch um einen "Internet Explorer_Server". D.h du musst den Text ins IHTMLDocument2 schreiben.
Habe das mal gemacht, habe die Funtion GetICQChatText in die Prozedur SetICQChatText umgewandelt,
nur leider wandelt er so das falsche Edit in meinen Text um.
Zuerst muss natürlich das Sende Control ermittelt werden.
Dann kannst du einen Text wie folgt setzen:

Delphi-Quellcode:
{htmlElement: IHTMLELEMENT;}

  htmlElement := Doc.getElementById('focus');
  htmlElement.innerhtml := 'hallo
von Delphi
';

Ich habe leider noch nicht herausfinden können, wie man den Text absenden kann.

Soweit mal der Testcode:

Delphi-Quellcode:
procedure TForm1.btnSetICQTextClick(Sender: TObject);
var
  htmlDoc2: IHTMLDocument2;
  HTMLDoc3: IHTMLDocument3;
  wndICQ, wndICQSendChat: HWND;
  htmlElement: IHTMLELEMENT;
begin
  wndICQ := FindWindow('__oxFrame.class__', 'ICQ_Anzeigename_hier_einsetzen');
  if wndICQ <> 0 then
  begin
    wndICQ := FindWindowEx(wndICQ, 0, '__oxFrame.class__', nil);
    wndICQSendChat := FindWindowEx(wndICQ, 0, 'Internet Explorer_Server', nil);
    htmlDoc2 := GetHTMLDocumentFromHWnd(wndICQSendChat);
    if htmlDoc2 <> nil then
    begin
      if htmlDoc2.QueryInterface(IHTMLDocument3, HTMLDoc3) = S_OK then
      begin
        htmlElement := HTMLDoc3.getElementById('focus');
        htmlElement.innerhtml := 'hallo
von Delphi
';
      end;
    end;
  end;
end;
Thomas
  Mit Zitat antworten Zitat