Solved

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

Posted on 2003-11-17
4
706 Views
Last Modified: 2013-11-25
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...
0
Comment
Question by:devmentee
  • 3
4 Comments
 
LVL 23

Accepted Solution

by:
Roshan Davis earned 125 total points
ID: 9764019
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
 

Author Comment

by:devmentee
ID: 9764221
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
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 9764257
You can use the ON_EVENT macro for that.
0
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 9764336
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

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
has77  challenge 9 82
tripleUp challenge 7 78
Runtime error 76: path not found error VB6 program on Windows 7 3 417
Fibonacci challenge 11 120
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now