How to generate a class with properties from an ActiveX control?
Greetings!
I am using Visual Studio 2008.
I need to generate a wrapper class for an ActiveX control that has public methods and a public property. The generated class has no methods for dealing with the ConnectionString property. What do I have to do to get it?
The definition of the class, using Visual Studio 6's OLE/COM Object Viewer, is below, along with the generated class files.
Also, if you would be so kind, could you point me to a replacement for the OLE/COM object viewer? It doesn't seem to ship with VS 2008 (or at least, I've never found it.
And what happened to word wrapping in this forum? As I'm typing this, "least" got split into two lines.
RobR
Code:
// Generated .IDL file (by the OLE/COM Object Viewer)
//
// typelib filename: ScheduleDisplay.ocx
[
uuid(08AA35D4-440B-4E9F-9086-EE7B30FBE945),
version(1.0),
helpstring("ScheduleDisplay ActiveX Control module"),
helpfile("ScheduleDisplay.hlp"),
helpcontext(00000000)
]
library ScheduleDisplayLib
{
// TLib : // TLib : OLE Automation : {00020430-0000-0000-C000-000000000046}
importlib("stdole2.tlb");
// Forward declare all types defined in this typelib
dispinterface _DScheduleDisplay;
dispinterface _DScheduleDisplayEvents;
[
uuid(E79DA7E1-5FDE-4087-ABE1-AE414576C00B),
helpstring("Dispatch interface for ScheduleDisplay Control")
]
dispinterface _DScheduleDisplay {
properties:
[id(0x00000001), helpstring("property ConnectionString")
]
BSTR ConnectionString;
methods:
[id(0xfffffdd8)]
void AboutBox();
[id(0x00000002), helpstring("method Draw")]
void Draw(
long left,
long top,
long right,
long bottom);
[id(0x00000003), helpstring("method DrawManager")]
void DrawManager(long pManager);
[id(0x00000004), helpstring("method GetManager")]
long GetManager();
};
[
uuid(2AAE5A5B-8091-4E0D-9A39-F55A00D7EC3D),
helpstring("Event interface for ScheduleDisplay Control")
]
dispinterface _DScheduleDisplayEvents {
properties:
methods:
};
[
uuid(86967618-BE35-440A-90F9-2D1306326BBD),
helpstring("ScheduleDisplay Control"),
control
]
coclass ScheduleDisplay {
[default] dispinterface _DScheduleDisplay;
[default, source] dispinterface _DScheduleDisplayEvents;
};
};
Re: How to generate a class with properties from an ActiveX control?
Which do you recommend I use? I mainly ask out of curiosity, since I already found an answer. I don't know if it's the best answer. I had been using "MFC Class from ActiveX Control". That gave me the public methods of my control, but it did not give me access to public properties. But when I used "MFC Class from Type Library", I got Set and Get methods for the property, and I was able to proceed from there.
Bookmarks