TApplication trouble in MFC

[sorry cross-posted in Discussion, think it might be more applicable here]


Am running ROOT 4.02 (also tried with 4.04) and using MS Visual C++ 6.0 to try to write an MFC Dialog-based Application that will allow me to open ROOT graphs and manipulate them using different member functions. I would like to be able to also zoom in and out on them (via use of TApplication) and cannot seem to figure out a way of doing both this and retaining the ability to open a new graph without the application crashing.
I have tried putting either a member or local TApplication variable in various places in the code and then using myApp->Run(), but I think maybe there is something I am missing out on.
Basically what I would like to be able to do is Open a TCanvas and draw a TGraph from a root file in one function, manipulate it using another function that uses other ROOT functions that don’t need a TApplication to run properly and then be able to start over with a different graph with the first function all the while having the ability to use ROOT functionality on the graphs. If that is possible using this version of ROOT, where should I run TApplication from? Is there anything else I need to specify?

I can post some of the code if that would make it more clear…



Here is an example of a MFC MDI Application with Root Canvases.
I hope it will be simple to adapt to your needs :wink:
It works with current CVS version. HTH.

MFCMDIRoot.zip (92.8 KB)


thanks for that…it was the timer that did the trick!