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?
 
Roshan DavisConnect With a Mentor Commented:
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
 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.