I would like to return a boolean value from a COM Method. This is essentially a VARIANT of type VT_BOOL. How do I tell the compiler to create this type in the typelib, or will I manually have to create the TYPELIB with this value?
Announcement
Collapse
No announcement yet.
COM Method Return Types
Collapse
X
-
Thomas,
Maybe try
Code:Method MyBoolean() as Variant Dim pVariant AS VARIANTAPI PTR Dim vBoolean as VARIANT pVariant = VarPtr(vBoolean) pVariant.vt = %VT_BOOLEAN vBoolean = 1 Method = vBoolean End Method
So here we are, this is the end.
But all that dies, is born again.
- From The Ashes (In This Moment)
-
I don't think so, because for a dual interface, he wants something like this in the *.idl
Code:[id(0x00000008), propget, helpstring("Returns/sets a value which specifies if a Node object is locked.")] HRESULT Locked([out, retval] VARIANT_BOOL* fLocked);
Code:FUNCTION treeINode_get_Locked(BYVAL pThis AS DWORD, fLocked AS INTEGER) AS LONG LOCAL pttid AS INode PTR pttid = pThis IF VARPTR(fLocked) = %NULL THEN FUNCTION = %E_POINTER EXIT FUNCTION END IF IF (@pttid.dwState AND %TIS_LOCKED) THEN fLocked = &HFFFF% ELSE fLocked = &H0000% END IF FUNCTION = %S_OK END FUNCTION
Or, if this was a property, output similar to this
Code:[id(0x00000002), helpstring("Sets or returns my flag."), helpcontext(0x000003f0)] VARIANT_BOOL MyBoolean;
Last edited by Dominic Mitchell; 5 Sep 2008, 07:47 AM.
Comment
Comment