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.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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?  
chrisbroadhurstAuthor Commented:
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.
Doing a QI against IE involves cranking up all of IE and its components. This is an expensive process. You can demonstrate this for yourself by writing a tiny test in-proc server and instantiating this and comparing the load/start times. If you are truly just starting out in MFC you might want to try some easier things to get going. In any event you can write a server in ATL v quickly (there might even be some samples with your SDK - and certainly floating about onthe web). Get one of these and compare the load times.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.