Enum problem in ATL full control.....

Hi
I have got a problem with ATL full control.
I have defined some enums in IDL and have some properties added to the
control of the enum type

for e.g.

 typedef enum
 {
  SUB, FENCE
 }BOXTYPE;

is defined as enum in library section of idl and 'boxType' is a property
added of type BOXTYPE to the control.

Now the problem is that in VB when the control is added to the form, in the
properties box ( accessed through F4), random values are shown for the
properties of these enum types.
Hence in the properties box, for the above boxType property some random
value such as 5864856- is shown instead of the values 0 / 1 or SUB / FENCE.

What is to be done in such a case?

I have also checked the .tlb through the OLE viewer and found that the definitions of the enums are perfect.

Thanx in advance
Rashmin



RashminAsked:
Who is Participating?
 
timopConnect With a Mentor Commented:
You have to use the following definition

typedef enum BOXTYPE
 {
  SUB, FENCE
 }BOXTYPE;

0
 
WynCommented:
Try

 typedef enum
 {
  SUB=0, FENCE=1
 }BOXTYPE;

0
 
RashminAuthor Commented:
Hi Wyn
I tried the above thing but it does not help. VB is still showing random values for the enum type properties.
Rashmin
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
WynCommented:
I dont know why.I think the sub and fence has been replaced by 0 and 1 at compiling time.It should work.I figure it's problem of VB'S:)
0
 
RashminAuthor Commented:
I've even checked the enum entries in the .tlb and values 0 and 1 are shown there but in VB it is always showing the value 5864856-. Moreover, it is not allowing to edit this value.
Please let me know what else can be done?
0
 
WynCommented:
Maybe the data type/int,byte.. is the reason.VB take it as int but maybe it's byte long.

0
 
RashminAuthor Commented:
yes it is true that if i make it long VB accepts it but then i cannot show the actual enum values in the properties box
0
 
RashminAuthor Commented:
Thanks timop. That works perfectly.
Thanks a lot again.
Rashmin
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.