Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
_COMATTRIB attributes have no effect
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00685958
Message ID:
00685975
Vues:
40
This message has been marked as the solution to the initial question of the thread.
I think what your missing is that all the strong typing and comattribs are ONLY info to put in the type library, the are NOT enforced. So, just as doing...

Local MyString AS String

Doesn't stop you from doing this:

MyString = 123

Neither does setting up a read_only attribute. You will have to use Access/Assign methods to set this up.

BOb


>Hi,
>
>I've written a class that uses the _COMATTRIB array to configure type library attributes. Some of them seem to have no effect at all. Below is the class code, which is compiled into an MT COM DLL.
>
>And here's what I would expect, but doesn't seem to work properly:
>
>
>x = CREATEOBJECT("sample.sample")
>
>*-- This shouldn't be possible, since the property is defined as read only
>*-- Note: The Object Browser shows the correct information (read-only).
>x.TimerInterval = 200
>
>*-- This shouldn't be possible, since the property is defined as read only.
>*-- Additionally this doesn't give me an error, but IMO it should, since the
>*-- property is numeric (TYPE("x.TimerInterval") returns "N").
>x.TimerInterval = "kjhk"
>
>
>
>
>* _COMATTRIB type library attributes
>#DEFINE COMATTRIB_RESTRICTED	0x1			&& Not accessible from macro languages.
>#DEFINE COMATTRIB_HIDDEN		0x40 		&& Not displayed to user.
>#DEFINE COMATTRIB_NONBROWSABLE	0x400 		&& appears in object browser, but not in properties browser.
>#DEFINE COMATTRIB_READONLY		0x100000	&& read-only (PropertyGet)
>#DEFINE COMATTRIB_WRITEONLY		0x200000	&& write-only (PropertyPut)
>
>DEFINE CLASS sample AS Session OLEPUBLIC
>
>	TimerInterval = 0
>	DIMENSION TimerInterval_COMATTRIB[5]
>	TimerInterval_COMATTRIB[1] = COMATTRIB_READONLY
>	TimerInterval_COMATTRIB[2] = ""
>	TimerInterval_COMATTRIB[3] = "TimerInterval"
>	TimerInterval_COMATTRIB[4] = "Long"
>	TimerInterval_COMATTRIB[5] = 0
>
>ENDDEFINE
>
>
>Am I missing something fundamental here, or is it really not working correctly?
>
>Thanks for any input,
>Armin
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform