1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76:
| unit Unit1;
interface
uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, OleCtrls, SHDocVw, ComCtrls, StdCtrls, jpeg, ExtCtrls, MSHTML_TLB;
type TForm1 = class(TForm) Button1: TButton; WebBrowser1: TWebBrowser; Button2: TButton; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); private public end;
var Form1: TForm1; Windir : Pchar; Windirec:String;
implementation
{$R *.DFM}
procedure delay(msec:longint); var start,stop:longint; begin start := gettickcount; repeat stop := gettickcount; application.processmessages; until (stop - start ) >= msec; end;
procedure TForm1.Button1Click(Sender: TObject); var Document: OleVariant; begin WebBrowser1.Navigate('file:///D:/m%fcll/Sende.html'); repeat Application.ProcessMessages; Sleep(0); until WebBrowser1.ReadyState = READYSTATE_COMPLETE; Document:= WebBrowser1.Document; Document.all.item('X-CONFIRM').checked:=true; delay(3000); end;
procedure TForm1.Button2Click(Sender: TObject); var Document: IHTMLDocument2; rbTestList: IHTMLElementCollection; rbTest: IHTMLOptionButtonElement; I: Integer; begin Document := WebBrowser1.Document as IHTMLDocument2; rbTestList := Document.all.item('Test', EmptyParam) as IHTMLElementCollection; for I := 0 to rbTestList.Length - 1 do begin rbTest := rbTestList.item(I, EmptyParam) as IHTMLOptionButtonElement; if rbTest.Checked then ShowMessageFmt('Der RadioButton mit dem Wert %s' + ' ist ausgewählt!', [rbTest.Value]); end; for I := 0 to rbTestList.Length - 1 do begin rbTest := rbTestList.item(I, EmptyParam) as IHTMLOptionButtonElement; if rbTest.Value = '2' then rbTest.Checked := True; end; end;
end. |