So far I've figured out how to pass Unicode strings, bSTRs, to and from a Euphoria DLL using a Typelib. What I can't figure out, thus far, is how to create and pass back an array of BSTRs.
The code I have thus far (along with includes for EuCOM itself and parts of Win32lib):
global function REALARR()
sequence seq
atom psa
atom va...
I'm in the process of creating a class that stores metadata about a particular data source. The metadata is structured in a tree, very similar to how XML is structured. The metadata values can be integer, decimal, or string values.
I'm curious if there is a good way in C++ to store variant data for a situation like this. I'd like for...
OK, so I couldn't really think of an apropos title that summarizes this.
The IPrintPipelinePropertyBag interface has the method AddProperty which aptly enough "adds a property to a property bag."
http://msdn.microsoft.com/en-us/library/aa506384.aspx
AddProperty( [in, string] const
wchar_t *pszName, [in] const
VARIANT *pVa...
I keep seeing the phrase "duck typing" bandied about, and even ran across a code example or two. I am way too lazy busy to do my own research, can someone tell me, briefly:
the difference between a 'duck type' and an old-skool 'variant type', and
provide an example of where I might prefer duck typing over variant typing, and
provide a...
Why can't Delphi variants hold objects? More importantly, what's the reason behind this limitation?
...
If, for example, you're going to write a variant type class, you will naturally need identification of what type an instance of that class is carrying. I'm wondering if anyone knows of any official or semi-official (de-facto?) reference of all primitive datatypes one would possibly be interested in?
Only primitives, and no need for abs...
Hi,
I have following block of code
/////////////////////////////////////
CComVariant newVal;
//pass the CComVariant and get the strings array!!!
GetStrList(newVal);
USES_CONVERSION;
if (((newVal.vt & VT_ARRAY) == VT_ARRAY) && ((newVal.vt & VT_BSTR) == VT_BSTR))
{
SAFEARRAY* paArray = newVal.parray;
BSTR * str = NULL;
SafeArray...
What's the main problem if I don't declare the type of a variable? Like, Dim var1 versus Dim var1 as Integer.
It can be anything so it should be good!
...
I have a procedure that expects a parameter of type TObject, something like this:
MyProcedure (const AValue : TObject);
I have an array of Variant that I'm looping through to call the procedure, something like this:
for i:=0 to High(myArray) do
MyProcedure (myArray[i]);
The compiler gives an error saying: "Incompatible types:...
All,
This error is driving me insane. I've spent 2 hours trying to figure it out and/or work around it with no luck. Here's the error:
"You tried to assign the NULL value to a variable that is not a Variant data type."
Here's my SQL:
SELECT tbl_budir_002.Location_Index, tbl_parent_001.NEWPARENTID
INTO tbl_budir_003
FROM (tbl_budi...
Should we use object or variant? What difference does it make?
...
In the .net CLR Object is the base for all class objects, but not basic types (e.g. int, float etc). How can I use basic types like Object?
I.e. Like Boost.Variant?
E.g. like :-
object intValue( int(27) );
if (intValue is Int32)
...
object varArray[3];
varArray[0] = float(3.141593);
varArray[1] = int(-1005);
varArray[2] = string("...
In variants.pas, there is several VarIsXXX( )-functions for type-checking a variant. There is no VarIsBoolean( ), though.
What's your preferred way of checking if a variant is of type boolean?
...
I have a situation where I've wrapped a Native C++ DLL with C++/CLI for eventual use in C#.
There are a few callback functions that are causing some issues at run time. Particularly, I get the following exception:
An unhandled exception of type
'System.Runtime.InteropServices.InvalidOleVariantTypeException'
occurred in ToadWra...
I have a COM object that I'm trying to use from C++ (not .NET), and all of the example programs and manual are written assuming the use of C#.NET or VB.NET. COM is new to me so I'm a bit overwhelmed. I'm using #import on the TLB but am struggling to deal with the variants that are used as parameters. I have one particular method, that ac...
class Test
{
public:
SOMETHING DoIt(int a)
{
float FLOAT = 1.2;
int INT = 2;
char CHAR = 'a';
switch(a)
{
case 1: return INT;
case 2: return FLOAT;
case 3: return CHAR;
}
}
};
int main(int argc, char* argv[])
{
Test obj;
cout<<obj.DoIt(1);
return 0;
}
Now, using the knowledge that a = 1 implies that...
FUNCTION SystemspartsClT.KeyFound(Key : AluCostDict.SystemspartskeyT) : BOOLEAN;
VAR v : Variant;
BEGIN
v := VarArrayCreate([0,1], VarInteger);
v[0] := Key.System;
v[1] := Key.PartType;
Sucess := t.Locate('System;PartType', v, []);
v := NULL;
Result := Sucess;
END;
I am using Delphi for Win32.
Does thi...
I am having an issue using a .NET/ComVisible assembly in Excel/VBA. I defined several parameters as "object" in .NET so they will be translated to Variant in VBA since optional parameters in VBA need to use Variant types.
The problem is when I try to use the object in Excel/VBA, I get a "Run-time error '424': Object required". I think I...
I'm using a third-party COM library from C#.
There are get/set methods that take a parameter of type VARIANT (type VT_BSTR).
In the .NET wrapper, these parameters appear as type object, i.e.
object getValue();
void setValue( object val );
The getValue method works ok, I perform a simple cast of the object to type string:
string str ...
I'm working with a OPC Server control that stores data tags as variant types, described by System.Runtime.InteropServices.VarEnum. These types include the following, VT_BSTR (string), VT_I2 (short) and VT_I4 (long).
All these values are stored by the server as objects and then I have to cast to the correct value when I fetch them.
I kn...