.\TPBtn.idl(135) : warning MIDL2362 : too many methods in the interface,
requires Windows NT 4.0 SP3 or greater : [ Interface 'ITPButton' ]
.\TPBtn.idl(307) : warning MIDL2366 : cannot assign a default value :
vBefore [ Procedure 'Add' ( Interface 'ITPButtonLib' ) ]
(NOTE: Version 5.0 of the compiler DID NOT issue any warning messages.)
Michael Morris wrote in message
<#PbYfPX8...@uppssnewspub05.moswest.msn.net>...
[id(7), helpstring("Adds an TPButton object to the list")] HRESULT
Add([in] VARIANT * pVarVal, [in, defaultvalue(0L), optional] VARIANT
vBefore, [in, defaultvalue(0L), optional] VARIANT vAfter);
Once again, this worked perfectly in VC version 5 but causes the warning
below in version 6. Thanks again for all
your assistance...
Michael Morris
Girish Bharadwaj [mvp] wrote in message ...
> [id(7), helpstring("Adds an TPButton object to the list")] HRESULT
>Add([in] VARIANT * pVarVal, [in, defaultvalue(0L), optional] LONG
>vBefore, [in, defaultvalue(0L), optional] LONG vAfter);
should work.
--
Girish Bharadwaj [VC++/MVP].
Dont send email queries to me directly.Please put
them on the newsgroups.
Thank you
Michael Morris wrote in message ...
Needless to say, VB has many optional VARIANT arguments to its functions.
Bill
Girish Bharadwaj [mvp] wrote in message
<#G2cwDg8...@uppssnewspub05.moswest.msn.net>...
--
Girish Bharadwaj [mvp/vc++]
Bill Rowe wrote in message ...
<snip>
You should not use the defaultvalue and the optional attribute together. The
optional attribute can only be used on variants and it really means that the
parameter is optional. The defaultvalue means the parameter is not optional,
but if it is not specified, a default value is used. The defaultvalue
attribute is mainly used to initialise default variables of base types (such
as int or enum's etc...).
In case of the optional attribute, the Variant will be of type VT_ERROR and
contain the scode DISP_E_PARAMNOTFOUND if the parameter is not specified.
(Check MS knowledgebase article Q153546).
Stefan.
Bill Rowe wrote in message ...
--
Girish Bharadwaj [VC++/MVP].
Dont send email queries to me directly.Please put
them on the newsgroups.
Thank you
Stefan Cuypers wrote in message ...
Oops... I realized my mistake. Yes, it must be explicit (a long, or
VARIANT_BOOL, or whatnot) if you want a default value that is consistent
from container to container (I'm sure some may support variant defaults, but
it isn't spelled out). I guess Michael is looking for a test like...
if ((OptArg.vt == VT_ERROR) && (OptArg.scode == DISP_E_PARAMNOTFOUND))
......
this should be the result of the [optional] VARIANT param being omitted.
BTW - the docs are very fuzzy, optional states that it must be a VARIANT or
*VARIANT, and defaultvalue suggests that the value must be 'able to be'
represented as a VARIANT. This is pretty stock though, and the above test
IS a very clear implemenation.
Bill
Girish Bharadwaj[mvp] wrote in message
<6vi219$ksh$1...@wbnws01.ne.highway1.com>...
>Of course, optional arguments have to be VARIANTs or variations of
>VARIANT*s. But, To supply a defaultvalue to an argument, it has to be
>strongly typed so that the typelib marshaller will know how to use that
>default value.
>
>--
>Girish Bharadwaj [mvp/vc++]
>
>Bill Rowe wrote in message ...
><snip>
>
>
>