Solved

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

Posted on 2003-11-17
4
696 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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…

757 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

21 Experts available now in Live!

Get 1:1 Help Now