Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ActiveX Control param problem

7 views
Skip to first unread message

Gijs

unread,
Oct 29, 2009, 4:14:02 AM10/29/09
to
Hello,

I’m writing an ActiveX Control in C++ using ATL, that should read and write
the param values of an ActiveX object. A few problems occurred while writing
this program.

<object id="MyControl" width="800" height="450"
classid="CLSID:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX">
<param name="FileName" value="text" />
</object>

First I have inherit from IPersistPropertyBagImpl so I can use the
IPersistPropertyBag. I also added the IPersistPropertyBag to the COM
interface using: COM_INTERFACE_ENTRY(IPersistPropertyBag) in
BEGIN_COM_MAP(CTestControl).
In the workspace view I right clicked on ITestControl, and selected "Add
Property". I setted the property type to BSTR and the name to "FileName". I
unchecked the "Get Function"-option and left the "Put Function"-option
enabled.
In my header file I added the “BEGIN_PROP_MAP(CTestControl)” with the
following entry “PROP_ENTRY("FileName",1,CLSID_NULL)”.
The wizard automatically added a function called
“CTestControl::put_FileName(BSTR newVal)”. I filled this function with a
printf to print the param value.

The first problem occurs because it wouldn’t compile. The variable
m_bRequiresSave was not defined causing the following error: “error C2039:
'm_bRequiresSave' : is not a member of 'CTestControl”. I solved it on a nasty
way, by adding the variable in my CTestControl class. After this the solution
compiled but it didn’t work properly.
It used to call “CTestControl::put_FileName(BSTR newVal)” via
“IPersistPropertyBagImpl” and print the param value. The program doesn’t
print this message, what indicates it doesn’t work. I’ve searched the
internet to solve this problem but couldn’t find a solution.
Is there a solution to solve this problem, or is there something I do wrong?
If there is another solution to get the param value please let me know.

Regards,

Gijs
Student at Avans University of Professional Education.

Gijs

unread,
Nov 23, 2009, 9:59:02 AM11/23/09
to
The problem is solved now.

The main problem was the class ID (CLSID), it was not filled in properly.
More information can ben found here:
http://www.codeproject.com/Messages/2042307/Re-ActiveX-IpropertyBag-Get-PARAM-NAMES.aspx

0 new messages