Using OCX in a SDI app.
PJ Durai -- pjdurai@pixtran.com Monday, July 15, 1996 VC++ 4.1 NT 3.51, 95 Hi People, I am trying to use an OLE control in the client area of an SDI full OLE server app. I had it imported from the component gallary and have a member of the generated class in my View class and create it in the OnCreate function of the view. Things work fine except I can't figure out how to catch the events fired from the OCX control. Since I am not using a dialog box or a form view I cant have an EVENT_MAP. ( that requires a control-id for the OCX control). Any ideas how to do this in a non-dialog app ? Documentation is very sketchy on this issue. Appreciate your time. pj
Mike Blaszczak -- mikeblas@msn.com Saturday, July 20, 1996 [Mini-digest: 4 responses] I'm not sure I understand the problem your facing: the CreateControl() function accepts an ID parameter which dictates the ID of the control you're creating. Why can't you make that ID parameter match the constant you specify in your EVENT_MAP? The sample in my book describes how to dynamically capture events thrown by controls which you've created with CreateControl(), so maybe you should have a look at that code if you need to handle multiple controls or dynamically create and destroy controls with different IDs. .B ekiM http://www.nwlink.com/~mikeblas ---------- From: owner-mfc-l@netcom.com on behalf of PJ Durai Sent: Friday, July 19, 1996 5:18 PM To: mfc-l@netcom.com Subject: Using OCX in a SDI app. VC++ 4.1 NT 3.51, 95 Hi People, I am trying to use an OLE control in the client area of an SDI full OLE server app. I had it imported from the component gallary and have a member of the generated class in my View class and create it in the OnCreate function of the view. Things work fine except I can't figure out how to catch the events fired from the OCX control. Since I am not using a dialog box or a form view I cant have an EVENT_MAP. ( that requires a control-id for the OCX control). Any ideas how to do this in a non-dialog app ? Documentation is very sketchy on this issue. Appreciate your time. pj -----From: murugesh@mail.cswl.com Hi, The easy way to do this is to insert the OCX Control in dialog and using the Class Wizard add the event handlers for the required events. And then cut&paste this event sink map to u'ver view class. This should work fine. Regards, Murugesh SS murugesh@cswl.com -----From: "Corporate Microcomputing Dept."There is an MSDN article on this (or maybe it was in the VC++ papers on the Web) called "Handling Events from Dynamically Instantiated OLE Controls" by John Elsbree. I found this after I figured out how to do this unfortunately but he explains it better. Basically you make a dummy dialog, add the control there, and then cut n paste to your other class. I also found an EVNET_REFLECT_MAP that allows the control class to handle it's own events without a control id. It doesn't matter what you pick for the id as long as it is unique among the controls. Dave Kolb SAS Institute -----From: mss@tartus.com (Michael Scherotter) Use a CFormView as the View Class. -- Michael S. Scherotter |Architectural Design Tools Lead Software Developer |AutoCAD Applications Tartus Development, Inc. |Custom CAD Solutions 630 Las Gallinas Ave #300 |__________________________ San Rafael, CA 94903 mss@tartus.com (415) 491-8925 michael@charette.com (415) 491-8921 (fax) 71035.1675@compuserve.com http://www.tartus.com/people/mss ____________________________________________________________
| Вернуться в корень Архива |