Home > Back-end >  Consult a cross thread calls components abnormal problems. I thank humbly. Have 2 days, not done!!!!
Consult a cross thread calls components abnormal problems. I thank humbly. Have 2 days, not done!!!!

Time:10-18

Procedure showJs ();
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
refer to the original poster nan1302351 response:
procedure showJs ();
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'));
.


Boss, I add the ah, no, ~ ~ ~ ~ ~ I just put my code to simplify, this is similar to small demo, added or abnormal the same!
Great!!!!!

CodePudding user response:

Access violation at address 68 a98099 module in 'MSHTML. DLL'. Read of address 000001 ec

The error message shows that the error code are in MSHTML.
in the DLL
This shows that you are in this sentence:
Wb. OleObject. Document. ParentWindow. GetAllPass (' DSFSDFSDF ', 'dssaas2', 'DDAWDDSDASD', '010001')

Is there a problem called

Passing parameters error or is unable to get the main line of certain resources, the key question may exist in the wb. OleObject. Document. ParentWindow

The Windows are there? You can consider using other techniques,
  • Related