After a few tries and failures I decided to start from the scratch. I
created a simple MFC ActiveX control containing only two properties --
Prop1 and Prop2 of type LONG -- and two empty methods -- Method1 and
Method2. All checkboxes and radio buttons in wizards were left on their
default values while doing that. I imported the control the same way as
before into a newly created MFC application and got the same problem:
wrapper class contained only Method1 and Method2, but no Get/Set
methods for the properties Prop1 and Prop2.
What am I doing wrong?
--
Best regards,
Vladimir.
I dont have the answer to this, except that are you certain that the
control that you are importing does indeed have get/set properties?
How are you certain about it.
Since you have Vc6, try importing the same control and see if you get
the get/set on the resulting .tlh/.tli.
---
Ajay
> are you certain that the control that you are importing does indeed
> have get/set properties? How are you certain about it.
I am certain because I wrote and used the control in a few projects :).
But I'm not talking about "get/set properties", it's just "properties".
The wizard mentioned in previous message (not #import directive!) should
generate h/cpp files for a wrapper class derived from CWnd containing
get/set methods for those properties (if there's a property named Prop1,
there should be GetProp1() and SetProp1() methods). At least it did in
vc6.
> Since you have Vc6, try importing the same control and see if you get
> the get/set on the resulting .tlh/.tli.
There's no tlh/tli files because I'm not using #import directive. When I
tried it, it generated get/set methods in both vc6 and vc2008, but
that's not what I need. I need CWnd derivate to use the control in
projects, not interfaces.
--
Best regards,
Vladimir.
I see what you are saying. I dont any answer for this though. There
may be some option that you may need to check in the wizard but I am
not sure.
---
Ajay
"Ajay Kalra" wrote:
Vladimir,
I do have the same issue with properties names in C++ generated wrapper
classes for the OCX.
VS 6 creates them as Get/SetSomeName and VS 2008 as get_/put_SomeName. So
far I don't know how to force VS 2008 to generate Get/Set names.
Did you find any solution for this problem?
Alex
> Vladimir,
>
> I do have the same issue with properties names in C++ generated wrapper
> classes for the OCX.
> VS 6 creates them as Get/SetSomeName and VS 2008 as get_/put_SomeName. So
> far I don't know how to force VS 2008 to generate Get/Set names.
> Did you find any solution for this problem?
Hi, Alex.
Seems like it simply doesn't work in VS 2008. I asked the same question
on CodeProject and MSDN forums and got no answer. I tried Google and
found a guy with the same problem -- in VS 2003! -- meaning this issue
existed long before VS 2008. Scary, don't you think?
I found out a workaround by accident. It's not elegant, but it does the
trick. When I put the OCX control on any dialog and create a member
variable of it, VS 2008 generates h/cpp files and Get/Set methods for
the properties correctly. Then I remove the member variable and OCX
control from the dialog and keep generated h/cpp files.
I hope this helps.
--
Best regards,
Vladimir.
Wow. Thats a neat trick. I would guess then that this feature exists
but either its a bug in your earlier scenario or simply a new feature.
---
Ajay
> Wow. Thats a neat trick. I would guess then that this feature exists
> but either its a bug in your earlier scenario or simply a new feature.
It's funny how both scenarios generated the same h/cpp files in good old
VS 6. Seems to me things have changed since. But hey, at least there is
a way for me to keep my old VS 6 projects unmodified -- it would be such
an "amusement" finding all Get/Set occurencies and replacing them with
get/put :[
--
Best regards,
Vladimir.
"Vladimir Svrkota" wrote:
This approach works for the properties without any input parameters. Wrapper
class calls them via GetProperty/SetProperty like:
GetProperty(0x59, VT_BOOL, (void*)&result);
SetProperty(0x59, VT_BOOL, propVal);
But it doesn’t work for properties with input parameter(s). Wrapper class
calls them via InvokeHelper like:
InvokeHelper(0x110, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, parms,
nCol);
InvokeHelper(0x110, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, nCol,
newValue);
These properties in VS2008 wrapper still have names like get_/put_:
It seems like I will use VS6 to generate wrapper classes so far.
Otherwise I have to redo a lot of code that use this OCX (well at least this
OCX is for my company internal use only).
Thanks,
Alex
>
example:
[id(1), helpstring("property ActiveSheet")] LONG ActiveSheet;
change to:
[id(1), propget, helpstring("property ActiveSheet")] LONG ActiveSheet();
[id(1), propput, helpstring("property ActiveSheet")] void ActiveSheet(LONG newVal);
and move these two lines into "methods section".
After that Property generated correctly by the MFC class From ActiveX control wizard