Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2003-11-17
4
Medium Priority
?
732 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 23

Accepted Solution

by:
Roshan Davis earned 500 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

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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…

718 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