Prev: MFC Feature Pack App with full frame docking
Next: New control styles with imported VC6 app in VS2008
From: nexolite on 1 May 2010 08:08 Hi, This method according to MSDN is "Called by the framework to notify an application when a document has achieved the READYSTATE_COMPLETE state." so if i do a long computation in this method it wont affect (freeze) the user interaction with IE ? I tried to put a for(;;); in this method but i think it freezes .. so do i need to put the time taking computation in a different thread ? Thanks
From: Scott McPhillips [MVP] on 1 May 2010 09:31 Any long computation in the main thread will freeze the UI. The thread can only do one thing at a time. "nexolite" <nexolite(a)discussions.microsoft.com> wrote in message news:1251652B-7134-4E80-9B31-66E9B7FE46CF(a)microsoft.com... > Hi, > > This method according to MSDN is "Called by the framework to notify an > application when a document has achieved the READYSTATE_COMPLETE state." > > so if i do a long computation in this method it wont affect (freeze) the > user interaction with IE ? > > I tried to put a for(;;); in this method but i think it freezes .. so do i > need to put the time taking computation in a different thread ? > > Thanks -- Scott McPhillips [VC++ MVP]
From: Hector Santos on 1 May 2010 11:17 nexolite wrote: > Hi, > > This method according to MSDN is "Called by the framework to notify an > application when a document has achieved the READYSTATE_COMPLETE state." > > so if i do a long computation in this method it wont affect (freeze) the > user interaction with IE ? > > I tried to put a for(;;); in this method but i think it freezes .. so do i > need to put the time taking computation in a different thread ? > In the Windows Messaging world, it is a cooperative multitasking concept. The OnDocumentComplete() is a message to your window and until that function is complete, no other message will be handled to service your Window, i.e. you can't move it, you can't click anything else, or rather you can, but will be queued up and delayed. The application freezes. That happens with any Windows message handler, like OnButtonClick() or OnWhatever(). If you do something that takes a long time, the message pump is no longer processing new messages that interact with your windows application. There are two ways to handle this: 1) Start a thread in the message handler to do whatever you want in the background and exit the message handler as fast as possible. See using AfxBeginThread() command in MSDN 2) Add message processing in the loop of your computation so that the message pump can send other messages to the window. See the GetMessage() or PeekMessage() commands in MSDN. Examples are provided. -- HLS
From: nexolite on 1 May 2010 12:21 yes but the thing is I want to modify the contents of the loaded html page based on the data fetched from remote server (which can take time of it will be another thread that will be started from OnDocumentComplete). So is it ok to pass LPDISPATCH pDisp to thread so that it can use it ? Thanks "Hector Santos" wrote: > nexolite wrote: > > > Hi, > > > > This method according to MSDN is "Called by the framework to notify an > > application when a document has achieved the READYSTATE_COMPLETE state." > > > > so if i do a long computation in this method it wont affect (freeze) the > > user interaction with IE ? > > > > I tried to put a for(;;); in this method but i think it freezes .. so do i > > need to put the time taking computation in a different thread ? > > > > In the Windows Messaging world, it is a cooperative multitasking > concept. The OnDocumentComplete() is a message to your window and > until that function is complete, no other message will be handled to > service your Window, i.e. you can't move it, you can't click anything > else, or rather you can, but will be queued up and delayed. The > application freezes. > > That happens with any Windows message handler, like OnButtonClick() or > OnWhatever(). If you do something that takes a long time, the message > pump is no longer processing new messages that interact with your > windows application. > > There are two ways to handle this: > > 1) Start a thread in the message handler to do whatever you want in > the background and exit the message handler as fast as possible. > > See using AfxBeginThread() command in MSDN > > 2) Add message processing in the loop of your computation so that > the message pump can send other messages to the window. > > See the GetMessage() or PeekMessage() commands in MSDN. Examples are > provided. > > -- > HLS > . >
From: nexolite on 1 May 2010 12:28 as mine is a BHO .. so can it be a problem if the previous tab is yet under processing and the user opens a new site in a tab ? Thanks "nexolite" wrote: > yes but the thing is I want to modify the contents of the loaded html page > based on the data fetched from remote server (which can take time of it will > be another thread that will be started from OnDocumentComplete). > > So is it ok to pass LPDISPATCH pDisp to thread so that it can use it ? > > Thanks > > "Hector Santos" wrote: > > > nexolite wrote: > > > > > Hi, > > > > > > This method according to MSDN is "Called by the framework to notify an > > > application when a document has achieved the READYSTATE_COMPLETE state." > > > > > > so if i do a long computation in this method it wont affect (freeze) the > > > user interaction with IE ? > > > > > > I tried to put a for(;;); in this method but i think it freezes .. so do i > > > need to put the time taking computation in a different thread ? > > > > > > > In the Windows Messaging world, it is a cooperative multitasking > > concept. The OnDocumentComplete() is a message to your window and > > until that function is complete, no other message will be handled to > > service your Window, i.e. you can't move it, you can't click anything > > else, or rather you can, but will be queued up and delayed. The > > application freezes. > > > > That happens with any Windows message handler, like OnButtonClick() or > > OnWhatever(). If you do something that takes a long time, the message > > pump is no longer processing new messages that interact with your > > windows application. > > > > There are two ways to handle this: > > > > 1) Start a thread in the message handler to do whatever you want in > > the background and exit the message handler as fast as possible. > > > > See using AfxBeginThread() command in MSDN > > > > 2) Add message processing in the loop of your computation so that > > the message pump can send other messages to the window. > > > > See the GetMessage() or PeekMessage() commands in MSDN. Examples are > > provided. > > > > -- > > HLS > > . > >
|
Next
|
Last
Pages: 1 2 3 4 5 Prev: MFC Feature Pack App with full frame docking Next: New control styles with imported VC6 app in VS2008 |