How to convert document-view to Active-X control using MFC???

Helloo guru's

I have two questions which are related.
I am converting an MFC application to an Active-Xcontrol  for embedding in browser. The app uses using document-view architecture (CFormview) currently.
My active-x control is using EnableSimpleFrame() and now I want to create/display a form view (CForm view based dialog) inside this control dynamically. I don't know how to show this view dynamically in my control so I get a form with other controls (like CEdit) on it.

Second I am also dynamically creating MSFlexGrid directly on the control in OnCreate(...) etc...now I do not know how I handle events generated by this grid??  since it is created dynamically (using embedded class member in my control) I cannot use classwizard etc.....
please throw some light on this...I am using this site for first time and allocation all the points I got. if you have a good solution which makes my easier..I will buy more points and allocate and this is a promise!
Many Thanks...
devmenteeAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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.

Roshan DavisCommented:
Try this MSDN Article "Designing ActiveX Components with the MFC Document/View Model" http://www.microsoft.com/mind/0497/mfc.asp

Also, you can find the Sample code

Rosh :)
0

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
devmenteeAuthor Commented:
roshmon,

many, many thanks...I will check it out asap...BTW do you know answer to my second questions...like how do I trap a "double click" event from my embedded flexgrid in my control??/ can't do this using classwizard since the grid is created dynamically in the control's constructor???

please let me know...
0
Roshan DavisCommented:
You can use the ON_EVENT macro for that.
0
Roshan DavisCommented:
That should be in ON_EVENT_SINK_MAP
Eg:
BEGIN_EVENTSINK_MAP(CTestDlg, CDialog)
       //{{AFX_EVENTSINK_MAP(CTestDlg)
       //}}AFX_EVENTSINK_MAP
       ON_EVENT_RANGE(
           CTestDlg,      // Class to which this event sink map belongs.
           IDC_FIRSTGRDID, // ID of the first control in the range.
           IDC_LASTGRDID,  // ID of the last control in the range.
           1,             // Dispatch ID of event fired by the control.
           TestOnProblem, // Function for handling events.
           VTS_I4 VTS_I2) // VTS_I4 and VTS_I2 are the first and second
                          // parameters of TestOnProblem() function.
   END_EVENTSINK_MAP()

Or you can try this class

http://www.codeguru.com/controls/gridctrl.shtml

Rosh :)
0
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
Microsoft Development

From novice to tech pro — start learning today.