Hi,
I have a site with some fields witch user fill and then press button to save those data.
Some user use web to fill those data, but I have made an windows application to fill those data and press button on site - Everything is working fine.
Now I need to make application for WM 6.5 and I did it but I have a problem with following lines :
On desktop windows I have (and it works) :
Var Browser:TEvsWebBrowser;
Doc: IHTMLDocument2;
WebForm: IHTMLFormElement;
FormElements: OleVariant;
_data: variant;
url,onull:Olevariant;
Browser:=TEvsWebBrowser.Create(Self);
ActiveXContainer.ComServer:=Browser.ComServer;
ActiveXContainer.Active:=true;
url:=Utf8decode('http://url.com');
onull:=NULL;
Browser.ComServer.Navigate2(url,onull,onull,onull,onull);
doc := Browser.ComServer.Document as IHTMLDocument2;
_data := '123456';
WebForm := Doc.Forms.Item(0,'') as IHTMLFormElement;
FormElements := WebForm.Elements;
FormElements.Item(4).Value := _data; // fill data
FormElements.Item(5).Click; // press button
Same code I wrote for WM 6.5 "
Var Browser:TEvsPIEWebBrowser;
url:widestring;
Doc: IPIEHTMLDocument2;
WebForm: IPIEHTMLFormElement;
FormElements: OleVariant;
_data: variant;
Browser:=TEvsPIEWebBrowser.Create(Self);
ActiveXContainer1.ComServer:=Browser.ComServer;
ActiveXContainer1.Active:=true;
url := 'http://url.com';
Browser.ComServer.Navigate(url,polevariant(nil)^,POleVariant(nil)^,polevariant(nil)^,polevariant(nil)^);
doc := Browser.ComServer.Document as IPIEHTMLDocument2;
_data := '12465';
WebForm := Doc.Forms.Item(0,'') as IPIEHTMLFormElement; <- this make exception on WM 6.5
Exception = Bus error or misaligned data access
// this is the part I cannot test
FormElements := WebForm.Elements;
FormElements.Item(4).Value := _data;
FormElements.Item(5).Click;
I had tried to declare and use :
Doc: IPIEHTMLDocument;
...
doc := Browser.ComServer.Document as IPIEHTMLDocument;
But I get the same error.
Any clue ?
Thx