# sicppsdk_win32.h File Reference

Win32 utilities. More...

`#include <sicppsdk.h>`
`#include <xsi_value.h>`

Go to the source code of this file.

## Functions
HRESULT | XSIVariantToCValue (VARIANT *in_Variant, XSI::CValue &out_val)
HRESULT | XSIVariantFromCValue (const XSI::CValue &in_value, VARIANT *out_var)

## Detailed Description

Win32 utilities.

Copyright 2008 Autodesk, Inc. All rights reserved. Use of this software is subject to the terms of the Autodesk license agreement provided at the time of installation or download, or which otherwise accompanies this software in either electronic or hard copy form.

## Function Documentation

HRESULT XSIVariantToCValue | ( | VARIANT * | in_Variant,
|  | XSI::CValue & | out_val |
| ) |  |  |

Helper to convert from the Win32 VARIANT structure to a CValue. This function is useful for plug-ins which mix the COM and C++ versions of the object model in their implementation.

The VARIANT is the data type used internally by scripting languages and, like CValue, it can represent many different types, including strings, objects, integers, doubles and arrays. A VARIANT containing a BSTR is converted to a CValue containing a CString. A VARIANT referring to a Softimage COM object is converted to a CValue containing the equivalent XSI::CRef object. A VARIANT referencing a SAFEARRAY is converted to a CValue containing a XSI::CValueArray. Some uncommon types of VARIANT are not supported, in which case `E_INVALIDARG` is returned.

Note:
  The XSI::CComAPIHandler object permits access to the COM version of the object model from C++, yet shields the caller from VARIANTs and other Win32-specific structures. Similarly, script code can call custom commands written in C++ and the arguments are automatically transformed from VARIANT to CValue without the need to call this routine explicitly.

Parameters:

  | in_Variant | Variant to convert. It is treated as const.

Return values:

  | out_val | CValue that is equivalent to the Variant.

Returns:
  HRESULT: A LONG representing success (S_OK) or error (E_INVALIDARG, S_FALSE).

See also:
  XSI::CValue, XSI::CStatus, XSI::CComAPIHandler

HRESULT XSIVariantFromCValue | ( | const XSI::CValue & | in_value,
|  | VARIANT * | out_var |
| ) |  |  |

Helper to convert from CValue to the Win32 VARIANT structure. Normally this routine is not needed because XSI::CComAPIHandler or automatic conversions shield the C++ API user from needing to deal with VARIANTs.

Parameters:

  | in_value | CValue to convert

Return values:

  | out_var | Address of a VARIANT to fill in based on the CValue's contents. The caller is reponsible for freeing the VARIANT with VariantClear().

Returns:
  HRESULT: A LONG representing success (S_OK) or error (E_INVALIDARG, S_FALSE).