Link to home
Start Free TrialLog in
Avatar of chrisbroadhurst
chrisbroadhurst

asked on

My MFC programs are taking longer and longer to load as time goes on!

I'm not great at MFC and copy examples in areas I do not fully understand.  In my InitInstance() I have the standard line  
ProcessShellCommand(cmdInfo) which eventually calls
pFrame = CreateNewFrame(pDocument, NULL);
by debugging the program it is this statement that is taking 20+ seconds.

So persumably I am clogging up some resource somewhere.

It would be great if somebody could point me in the right direction and also say what I should be doing in future to stop this accumulation.

Thanks
Chris
Avatar of ethrbunny
ethrbunny

MFC carries a large amount of baggage around in the std doc/frame/view model. Is your system relatively robust? do you have lots of RAM? You could try writing some apps using just a CDialog to see whether or not ditching the basic model (DFV above) runs any faster. CDialog will let you do a great many things without all the overhead you are experiencing. In any event if you aren't basing your app on a doc/view architecture then its just wasted resources.
Is it taking 20+ seconds in both debug and release?  
Avatar of chrisbroadhurst

ASKER

No it does not matter if it is Debug or Release mode. I have lots&lots of ram. However, since I have 'regclean'ed the machine, it has improved.  The other (relevant?) fact that this program is using QueryInterface(IID_IWebBrowser2) & CSingleDocTemplate (copied from the mfcie example).  My other MFC programs, not using the IEbrowser and using CMultiDocTemplate, have always loaded quickly.
ASKER CERTIFIED SOLUTION
Avatar of ethrbunny
ethrbunny

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of DanRollins
I agree.  It is the IE component that is slowing down the load.  It collects tons of baggage over time, including various addins, I think.

What I did was work out a way to bring up my entire user interface *except* the IE window.  Then if the HTML window takes a little time to draw, the user's are not too unhappy.

-- Dan