Home > Software engineering >  MFC webbrowser control thread used in error
MFC webbrowser control thread used in error

Time:11-07

In the program, the auxiliary thread calls the main thread of the IHTMLDocument2 object, then the inside of the access to one of the IHTMLElement content, such as:
PEle - & gt; Get_innerText (& amp; BSTR); There was a memory access conflict error! But there is no problem in the main thread can get page tag value, can also give page label assignment,

CodePudding user response:

Trouble you see what the problem is caused by??????? Thank you very much!

CodePudding user response:


The child thread do not operate the UI

CodePudding user response:

My thread is a serial port to receive the thread, will take the data displayed in a web page, give the page label assignment is an error, how to avoid this problem??

CodePudding user response:

Across threads window operation, the need to pass a handle to the window, it is not can pass a pointer to the way you think is wrong, should be a secondary thread hair message, the main thread to accept the message, and then deal with interface problem

CodePudding user response:

reference dailihuiopt reply: 3/f
my thread is a serial port to receive the thread, will take the data displayed in a web page, give the page label assignment is an error, how to avoid this problem??

The child thread to the main thread post/send message. The main thread receives news, update the UI

CodePudding user response:

Thread used in the COM component is to initialize the COM libraries first, try in the thread CoInitialize

CodePudding user response:

The COM component is the STA (mostly), can't across threads, you can to update the ActiveX container window from the definition of news, in the update of the container in the window procedure,

CodePudding user response:

Thread points
User threads (UI thread)
And the worker thread
  • Related