I try to call from C# a COM method that require that a parameter of type VARIANT is defined as VT_USERDEFINED (it also accept other types, but it have a special handling of VT_USERDEFINED).
The interface is:
HRESULT GetRecord(
[in] VARIANT varKey,
[out] VARIANT* pvarRecord);
The question is how to call this method from C# where varKey is an integer defined as VT_USERDEFINED.
The COM interop DLL is generated by tlbimp.exe from the idl file in C++.
Edit 1 The code on the C++ side is like this:
if (varKey.vt == VT_USERDEFINED)
{
// Sequential record number given
UINT uintRecordNumber = varKey.uintVal;
...
}