The begin
//this means that perform the js script returns value for the wb, wb has a js method named getAllPass
Showmessage (wb) OleObject) document. ParentWindow. GetAllPass (' DSFSDFSDF ', 'dssaas2', 'DDAWDDSDASD', '010001'));
end;
Procedure Tform_Main. Btn_FailClick (Sender: TObject);
Var
Id: dword;
The begin
ShowJs ();//in the main thread can be executed correctly,
CreateThread (nil, 0, @ showJs, nil, 0, id);//in a multithreaded will appear the exception (Access violation at address 68 a98099 module in 'MSHTML. DLL'. Read of address 000001 ec)
end;
{I want to, in a multithreaded execution wb. OleObject. Document. ParentWindow. GetAllPass (' DSFSDFSDF ', 'dssaas2', 'DDAWDDSDASD', '010001'), I want to value, but is more exceptions, and one day soon, baidu/Google hasn't done, only to CSDN please Daniel! I thank you! How to solve? }
CodePudding user response:
Plus coInitialize try and using ShowMessage, had better not in a thread, use MessageBox (0,... );
USES the ActiveX.
Procedure showJs ();
The begin
CoInitialize (nil);
Try
//this means that perform the js script returns value for the wb, wb has a js method named getAllPass
Showmessage (wb) OleObject) document. ParentWindow. GetAllPass (' DSFSDFSDF ', 'dssaas2', 'DDAWDDSDASD', '010001'));
The finally
CoUninitialize;
end;
end;
CodePudding user response:
The