It is known that in COM Automation Types the type is not supported:

IDL type Variant type OLEAutomation Description __int64 VT_I8 No 8-byte signed integer 

It would be possible to use double (VT_R8) since no mathematical operations are intended only for the function get_value \ set_value:

 IDL type Variant type OLEAutomation Description double VT_R8 Yes 8-byte real 

But there are fears that if you need to output these values ​​to a file or to print, then convert to __int64 it will be very problematic in some kind of JScript \ VBScript. On the other hand, using strings is some kind of clumsy solution in this case.

What is the solution in this case?

  • Is JScript\VBScript support required? Say, powershell in terms of COM-interaction knows how much more, even though it is hidden deeper - Pavel Mayorov
  • Yes it is. - cpp_user

1 answer 1

If there is no type you need are long, you need to assemble it from smaller suitable ones. As far as I know, Variant can type Byte, which corresponds to the unsgined char. Those. you can use 8 bytes, and you can assemble a type on the target platform - a matter of technology: there are perhaps shift and bitwise operations everywhere .

  • And how is this type of several byte represented in IDL? Or do you propose to make a new interface with 8 methods (SetFirstByte, SetSecondByte, ...)? PS This option is even less convenient than the string. - cpp_user
  • The same is Array: msdn.microsoft.com/en-US/library/ee267517%28v=bts.10%29.aspx ? It is a pity, of course, that unsigned UI4 is not supported, then a pair of I4 + UI4 would be enough. - Monah Tuk
  • SafeArray is hellish thrash for such an easy task. It turns out that the line is the least evil. - cpp_user
  • No, well, you can do with two VT_I4 and one VT_I1. And so, it turns out that yes. - Monah Tuk