From: Alex Ganyukov Alex on


"Ajay Kalra" wrote:

> On Apr 9, 2:39 am, Vladimir Svrkota <s...(a)reply.to> wrote:
> > Ajay Kalra wrote:
> > > 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.
> >
>
> 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
>
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
From: Vladimir Svrkota on
Alex Ganyukov 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?

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.
From: Ajay Kalra on
> 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.
>

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
From: Vladimir Svrkota on
Ajay Kalra wrote:

> 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.
From: Alex Ganyukov on


"Vladimir Svrkota" wrote:

> Ajay Kalra wrote:
>
> > 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.

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

>