IPersistPropertyBag/IPersistPropertyBagImpl question
-
Has anyone used this successfully? :) I need to do something so simple it's pathetic, but I haven't figured out HOW... Here's what I want to do: I'd like to have a webpage that loads my dll (it's in a cab and all that)... And it's being called like this:
<object classid="clsid:XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" codebase="XXXXXX.CAB">
<param name="text" value="Yo man!">
</object>So here's the deal... All I want said application to do... Is to be able to get that text in the param tag!!! Any hints/code snippets in the right direction? :) I've been having a bugger of a time, and Microsoft's help pages are of NO help for a newb like me! :) I know it's probably something easy, but I can't get it to work! Thanks in advance!
-
Has anyone used this successfully? :) I need to do something so simple it's pathetic, but I haven't figured out HOW... Here's what I want to do: I'd like to have a webpage that loads my dll (it's in a cab and all that)... And it's being called like this:
<object classid="clsid:XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" codebase="XXXXXX.CAB">
<param name="text" value="Yo man!">
</object>So here's the deal... All I want said application to do... Is to be able to get that text in the param tag!!! Any hints/code snippets in the right direction? :) I've been having a bugger of a time, and Microsoft's help pages are of NO help for a newb like me! :) I know it's probably something easy, but I can't get it to work! Thanks in advance!
The problem is that the simple stuff doesn't work with BSTRs In DevStudio6, If my ATL control had the interface
ITestControl
& the class nameCTestControl
, I would do the following... * Inherit fromIPersistPropertyBagImpl
* addCOM_INTERFACE_ENTRY(IPersistPropertyBag)
toBEGIN_COM_MAP(CTestControl)
* Add a member variable that will store the "Yo man!", maybeCComBSTR m_bsText;
* In workspace view, right click on ITestControl, and select "Add Property" - Set the property type to BSTR, - the name to "test", - uncheck "Get Function" - leave "Put Function" enabled - Remember the "id(n)" number displayed in the implementation preview at the bottom of the dialog, you'll need that. It's the dispatch ID * In your header file, look forBEGIN_PROP_MAP(CTestControl)
- Add the entryPROP_DATA_ENTRY("test",1,CLSID_NULL)
. Observe that the number (in this case 1) is THE SAME dispatch ID for the property you just added! * Modify the newly created "CTestControl::put_test(BSTR newVal)
" to assign newVal to the local variablem_bsText
. Now when your control loads,IPersistPropertyBagImpl
will callCTestControl::put_test(BSTR newVal)
and store the value "Yo man!" in m_bsText -
The problem is that the simple stuff doesn't work with BSTRs In DevStudio6, If my ATL control had the interface
ITestControl
& the class nameCTestControl
, I would do the following... * Inherit fromIPersistPropertyBagImpl
* addCOM_INTERFACE_ENTRY(IPersistPropertyBag)
toBEGIN_COM_MAP(CTestControl)
* Add a member variable that will store the "Yo man!", maybeCComBSTR m_bsText;
* In workspace view, right click on ITestControl, and select "Add Property" - Set the property type to BSTR, - the name to "test", - uncheck "Get Function" - leave "Put Function" enabled - Remember the "id(n)" number displayed in the implementation preview at the bottom of the dialog, you'll need that. It's the dispatch ID * In your header file, look forBEGIN_PROP_MAP(CTestControl)
- Add the entryPROP_DATA_ENTRY("test",1,CLSID_NULL)
. Observe that the number (in this case 1) is THE SAME dispatch ID for the property you just added! * Modify the newly created "CTestControl::put_test(BSTR newVal)
" to assign newVal to the local variablem_bsText
. Now when your control loads,IPersistPropertyBagImpl
will callCTestControl::put_test(BSTR newVal)
and store the value "Yo man!" in m_bsTextWow, thanks SO much. :) That totally answers my question. :) I'll give it a try and see what happens. Thanks again, Jason!
-
The problem is that the simple stuff doesn't work with BSTRs In DevStudio6, If my ATL control had the interface
ITestControl
& the class nameCTestControl
, I would do the following... * Inherit fromIPersistPropertyBagImpl
* addCOM_INTERFACE_ENTRY(IPersistPropertyBag)
toBEGIN_COM_MAP(CTestControl)
* Add a member variable that will store the "Yo man!", maybeCComBSTR m_bsText;
* In workspace view, right click on ITestControl, and select "Add Property" - Set the property type to BSTR, - the name to "test", - uncheck "Get Function" - leave "Put Function" enabled - Remember the "id(n)" number displayed in the implementation preview at the bottom of the dialog, you'll need that. It's the dispatch ID * In your header file, look forBEGIN_PROP_MAP(CTestControl)
- Add the entryPROP_DATA_ENTRY("test",1,CLSID_NULL)
. Observe that the number (in this case 1) is THE SAME dispatch ID for the property you just added! * Modify the newly created "CTestControl::put_test(BSTR newVal)
" to assign newVal to the local variablem_bsText
. Now when your control loads,IPersistPropertyBagImpl
will callCTestControl::put_test(BSTR newVal)
and store the value "Yo man!" in m_bsTextWell, I gave that a try... The only thing is this... ;) I had to add these two parts in: (110) BEGIN_COM_MAP(CIEBand) (111) COM_INTERFACE_ENTRY(IPersistPropertyBag) (112) END_COM_MAP() (113) (114) BEGIN_PROP_MAP(CIEBand) (115) PROP_DATA_ENTRY("text",1,CLSID_NULL) (116) END_PROP_MAP() I didn't have the com or prop maps in there before... When I went to compile, it crapped out on the PROP_DATA_ENTRY line, with the following error(s): IEBand.h(115) : error C2059: syntax error : 'constant' IEBand.h(115) : error C2059: syntax error : ',' IEBand.h(116) : error C2143: syntax error : missing ';' before '{' IEBand.h(116) : error C2447: '{' : missing function header (old-style formal list?) IEBand.h(116) : error C2059: syntax error : '}' IEBand.h(116) : error C2059: syntax error : 'return' IEBand.h(116) : error C2059: syntax error : '}' YOUCH! :P Any thoughts on this?
-
Well, I gave that a try... The only thing is this... ;) I had to add these two parts in: (110) BEGIN_COM_MAP(CIEBand) (111) COM_INTERFACE_ENTRY(IPersistPropertyBag) (112) END_COM_MAP() (113) (114) BEGIN_PROP_MAP(CIEBand) (115) PROP_DATA_ENTRY("text",1,CLSID_NULL) (116) END_PROP_MAP() I didn't have the com or prop maps in there before... When I went to compile, it crapped out on the PROP_DATA_ENTRY line, with the following error(s): IEBand.h(115) : error C2059: syntax error : 'constant' IEBand.h(115) : error C2059: syntax error : ',' IEBand.h(116) : error C2143: syntax error : missing ';' before '{' IEBand.h(116) : error C2447: '{' : missing function header (old-style formal list?) IEBand.h(116) : error C2059: syntax error : '}' IEBand.h(116) : error C2059: syntax error : 'return' IEBand.h(116) : error C2059: syntax error : '}' YOUCH! :P Any thoughts on this?
Whoops! :doh:
**PROP_ENTRY**("test", 1, CLSID_NULL)
Did I mention that individual milage may vary? ;) -
Whoops! :doh:
**PROP_ENTRY**("test", 1, CLSID_NULL)
Did I mention that individual milage may vary? ;)Heheheh. :) Yeah, figured that out JUST a second ago. :P Thanks a ton, buddy. :)