adding CLSID_CPicturePropPage to Object
Michael S. Scherotter -- mss@tartus.com
Monday, May 13, 1996
Using MFC 4.1, NT 3.51
I have created a COM object derrived from CCmdTarget.
I added the interface ISpecifyPropertyPages to it object.
Using the BEGIN_PROPPAGEIDS() macro, I have successfully listed the property
pages which will be specified.
I added the property page CLSID_CPicturePropPage to the list, and the page
appears with no problem, but with no functionality(buttons & edit box are
disabled). How can I access and associate a CPictureHolder member variable in my
COM object with the Picture Property Page?
In my COM object, I have this code in the dispatch map:
DISP_PROPERTY_EX(BCObject, "Picture", GetPicture, SetPicture, VT_PICTURE)
Michael
--
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
____________________________________________________________
John & Annette Elsbree -- elsbree@msn.com
Thursday, May 23, 1996
Michael -
Your class needs a type library containing information about the properties it
supports. The stock property pages populate their property name lists by
obtaining the object's type info and enumerating its properties, looking for
those that match a specific type (in the case of the picture property page, it
looks for properties of type IPictureDisp*).
To give your class a type library, you'll need to take the following steps:
1. Create an .ODL file. Probably the easiest way to do this is to use
ControlWizard to generate a dummy project, and steal the .ODL file from this
project. Remove the control-specific parts (e.g., the "[control]" attribute at
various places, and the event interface), and synchronize the IID and CLSID
with those in your existing code.
2. Add the .ODL file to your project. The build system will automatically
generate a .TLB file when you build the project, by running MKTYPLIB on your
.ODL file.
3. Reference the .TLB file in your .RC file by choosing View.ResourceIncludes,
and entering the following line under Compile-time directives:
1 TYPELIB filename.TLB
4. Add a DECLARE_OLETYPELIB macro to your class's .H file, and an
IMPLEMENT_OLETYPELIB macro to your .CPP file. Again, look at how it's done in
a ControlWizard-generated project.
5. Add self-registration code for the type library, by calling
AfxOleRegisterTypeLib from your DllRegisterServer function. Once again, use
ControlWizard as your guide.
6. After building your project, use REGSVR32.EXE to invoke your server's
self-registration code.
Once you have a type library, you'll need to add an entry for each of your
server's properties to the .ODL file. For example, the entry for your Picture
property should look something like this:
properties:
[id(1)] IPictureDisp* Picture;
The actual ID value will need to vary, depending on the Picture property's
position (1-based) in your dispatch map. (e.g., if the property is the fourth
entry in the dispatch map, use [id(4)].
Now (if I haven't missed any steps), the stock picture page should recognize
your Picture property and display it accordingly.
John Elsbree (not speaking for Microsoft)
----------
From: owner-mfc-l@netcom.com on behalf of Michael Scherotter
> Using MFC 4.1, NT 3.51
> I have created a COM object derrived from CCmdTarget.
> I added the interface ISpecifyPropertyPages to it object.
> Using the BEGIN_PROPPAGEIDS() macro, I have successfully listed the property
> pages which will be specified.
> I added the property page CLSID_CPicturePropPage to the list, and the page
> appears with no problem, but with no functionality(buttons & edit box are
> disabled). How can I access and associate a CPictureHolder member variable
in my
> COM object with the Picture Property Page?
| Вернуться в корень Архива
|