# WinStd: WinStdCOMHelpers

Loading...
Searching...
No Matches
WinStdCOMHelpers

## Functions

VARIANT & | operator<< (VARIANT &v, IDispatch *value)
| Saves value to VARIANT.
VARIANT & | operator<< (VARIANT &v, const CHAR value)
| Saves value to VARIANT.
VARIANT & | operator<< (VARIANT &v, const BYTE value)
| Saves value to VARIANT.
VARIANT & | operator<< (VARIANT &v, const SHORT value)
| Saves value to VARIANT.
VARIANT & | operator<< (VARIANT &v, const USHORT value)
| Saves value to VARIANT.
VARIANT & | operator<< (VARIANT &v, const LONG value)
| Saves value to VARIANT.
VARIANT & | operator<< (VARIANT &v, const ULONG value)
| Saves value to VARIANT.
VARIANT & | operator<< (VARIANT &v, const LONGLONG value)
| Saves value to VARIANT.
VARIANT & | operator<< (VARIANT &v, const ULONGLONG value)
| Saves value to VARIANT.
VARIANT & | operator<< (VARIANT &v, const FLOAT value)
| Saves value to VARIANT.
VARIANT & | operator<< (VARIANT &v, const DOUBLE value)
| Saves value to VARIANT.
VARIANT & | operator<< (VARIANT &v, const BOOL value)
| Saves value to VARIANT.
VARIANT & | operator<< (VARIANT &v, LPCOLESTR value)
| Saves value to VARIANT.
template<class _Traits , class _Ax >
VARIANT & | operator<< (VARIANT &v, const std::basic_string< OLECHAR, _Traits, _Ax > &value)
| Saves value to VARIANT.
VARIANT & | operator<< (VARIANT &v, const GUID &value)
| Saves value to VARIANT.
VARIANT | winstd::BuildVBARRAY (VARTYPE vt, LPCVOID array, ULONG columns, ULONG rows)
| Builds VBARRAY of uniform data.
template<class T , ULONG columns = 1>
VARIANT | winstd::BuildVBARRAY (const T *array, ULONG rows)
| Builds VBARRAY of uniform data.
VARIANT | winstd::BuildVBARRAY (HDC dc, HBITMAP pic)
| Builds VBARRAY containing BMP image.
template<class T >
void | winstd::IDispatchInvoke (T *cp, DISPID id, DISPPARAMS *param, LCID locale=LOCALE_USER_DEFAULT)
| Calls IDispatch::Invoke.
template<class T >
T | winstd::VariantAsInteger (const VARIANT *var, T fallback=0)
| Check VARIANT value for integer value.
BOOL | winstd::VariantAsBoolean (const VARIANT *var, BOOL fallback=FALSE)
| Check VARIANT value for boolean value.

## Detailed Description

## Function Documentation

## BuildVBARRAY() [1/3]

template<class T , ULONG columns = 1>

VARIANT winstd::BuildVBARRAY | ( | const T * | array,
|  | ULONG | rows )

Builds VBARRAY of uniform data.

This template is using operator <<(VARIANT&, const T&) to write data to VBARRAY. Such operator must be declared for given datatype T.

Template Parameters

  T | Element type
  columns | Number of columns. When 1, SafeArrayCreateVector is used; when >1, SafeArrayCreate is used.

Parameters

  array | Pointer to data
  rows | Number of rows of data

Returns
  Returns VBARRAY

## BuildVBARRAY() [2/3]

VARIANT winstd::BuildVBARRAY | ( | HDC | dc,
|  | HBITMAP | pic )

inline

Builds VBARRAY containing BMP image.

Parameters

  [in] | dc | Drawing context
  [in] | rows | Bitmap handle

Returns
  Returns VBARRAY

## BuildVBARRAY() [3/3]

VARIANT winstd::BuildVBARRAY | ( | VARTYPE | vt,
|  | LPCVOID | array,
|  | ULONG | columns,
|  | ULONG | rows )

inline

Builds VBARRAY of uniform data.

Parameters

  [in] | vt | Type of array element
  [in] | array | Pointer to data
  [in] | columns | Number of columns. When 1, SafeArrayCreateVector is used; when >1, SafeArrayCreate is used.
  [in] | rows | Number of rows

Returns
  Returns VBARRAY

## IDispatchInvoke()

template<class T >

void winstd::IDispatchInvoke | ( | T * | cp,
|  | DISPID | id,
|  | DISPPARAMS * | param,
|  | LCID | locale = LOCALE_USER_DEFAULT )

Calls IDispatch::Invoke.

Template Parameters

  T | Original interface type

Parameters

  [in] | cp | Any interface of the class that implements IDispatch
  [in] | id | ID of method to invoke
  [in] | param | Parameters for the method to invoke
  [in] | locale | Locale for the invoke call

## operator<<() [1/15]

VARIANT & operator<< | ( | VARIANT & | v,
|  | const BOOL | value )

inline

Saves value to VARIANT.

Parameters

  [out] | v | VARIANT to save value to. For performance reasons, no VariantClear is called before saving. Thus, v must not contain referenced data.
  [in] | value | Value to save

Returns
  Reference to VARIANT successor in array of VARIANT(s)

## operator<<() [2/15]

VARIANT & operator<< | ( | VARIANT & | v,
|  | const BYTE | value )

inline

Saves value to VARIANT.

Parameters

  [out] | v | VARIANT to save value to. For performance reasons, no VariantClear is called before saving. Thus, v must not contain referenced data.
  [in] | value | Value to save

Returns
  Reference to VARIANT successor in array of VARIANT(s)

## operator<<() [3/15]

VARIANT & operator<< | ( | VARIANT & | v,
|  | const CHAR | value )

inline

Saves value to VARIANT.

Parameters

  [out] | v | VARIANT to save value to. For performance reasons, no VariantClear is called before saving. Thus, v must not contain referenced data.
  [in] | value | Value to save

Returns
  Reference to VARIANT successor in array of VARIANT(s)

## operator<<() [4/15]

VARIANT & operator<< | ( | VARIANT & | v,
|  | const DOUBLE | value )

inline

Saves value to VARIANT.

Parameters

  [out] | v | VARIANT to save value to. For performance reasons, no VariantClear is called before saving. Thus, v must not contain referenced data.
  [in] | value | Value to save

Returns
  Reference to VARIANT successor in array of VARIANT(s)

## operator<<() [5/15]

VARIANT & operator<< | ( | VARIANT & | v,
|  | const FLOAT | value )

inline

Saves value to VARIANT.

Parameters

  [out] | v | VARIANT to save value to. For performance reasons, no VariantClear is called before saving. Thus, v must not contain referenced data.
  [in] | value | Value to save

Returns
  Reference to VARIANT successor in array of VARIANT(s)

## operator<<() [6/15]

VARIANT & operator<< | ( | VARIANT & | v,
|  | const GUID & | value )

inline

Saves value to VARIANT.

Note
  This operator saves GUID as BSTR string in "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" notation.

Parameters

  [out] | v | VARIANT to save value to. For performance reasons, no VariantClear is called before saving. Thus, v must not contain referenced data.
  [in] | value | Value to save

Returns
  Reference to VARIANT successor in array of VARIANT(s)

## operator<<() [7/15]

VARIANT & operator<< | ( | VARIANT & | v,
|  | const LONG | value )

inline

Saves value to VARIANT.

Parameters

  [out] | v | VARIANT to save value to. For performance reasons, no VariantClear is called before saving. Thus, v must not contain referenced data.
  [in] | value | Value to save

Returns
  Reference to VARIANT successor in array of VARIANT(s)

## operator<<() [8/15]

VARIANT & operator<< | ( | VARIANT & | v,
|  | const LONGLONG | value )

inline

Saves value to VARIANT.

Parameters

  [out] | v | VARIANT to save value to. For performance reasons, no VariantClear is called before saving. Thus, v must not contain referenced data.
  [in] | value | Value to save

Returns
  Reference to VARIANT successor in array of VARIANT(s)

## operator<<() [9/15]

VARIANT & operator<< | ( | VARIANT & | v,
|  | const SHORT | value )

inline

Saves value to VARIANT.

Parameters

  [out] | v | VARIANT to save value to. For performance reasons, no VariantClear is called before saving. Thus, v must not contain referenced data.
  [in] | value | Value to save

Returns
  Reference to VARIANT successor in array of VARIANT(s)

## operator<<() [10/15]

template<class _Traits , class _Ax >

VARIANT & operator<< | ( | VARIANT & | v,
|  | const std::basic_string< OLECHAR, _Traits, _Ax > & | value )

inline

Saves value to VARIANT.

Parameters

  [out] | v | VARIANT to save value to. For performance reasons, no VariantClear is called before saving. Thus, v must not contain referenced data.
  [in] | value | Value to save

Returns
  Reference to VARIANT successor in array of VARIANT(s)

## operator<<() [11/15]

VARIANT & operator<< | ( | VARIANT & | v,
|  | const ULONG | value )

inline

Saves value to VARIANT.

Parameters

  [out] | v | VARIANT to save value to. For performance reasons, no VariantClear is called before saving. Thus, v must not contain referenced data.
  [in] | value | Value to save

Returns
  Reference to VARIANT successor in array of VARIANT(s)

## operator<<() [12/15]

VARIANT & operator<< | ( | VARIANT & | v,
|  | const ULONGLONG | value )

inline

Saves value to VARIANT.

Parameters

  [out] | v | VARIANT to save value to. For performance reasons, no VariantClear is called before saving. Thus, v must not contain referenced data.
  [in] | value | Value to save

Returns
  Reference to VARIANT successor in array of VARIANT(s)

## operator<<() [13/15]

VARIANT & operator<< | ( | VARIANT & | v,
|  | const USHORT | value )

inline

Saves value to VARIANT.

Parameters

  [out] | v | VARIANT to save value to. For performance reasons, no VariantClear is called before saving. Thus, v must not contain referenced data.
  [in] | value | Value to save

Returns
  Reference to VARIANT successor in array of VARIANT(s)

## operator<<() [14/15]

VARIANT & operator<< | ( | VARIANT & | v,
|  | IDispatch * | value )

inline

Saves value to VARIANT.

Parameters

  [out] | v | VARIANT to save value to. For performance reasons, no VariantClear is called before saving. Thus, v must not contain referenced data.
  [in] | value | Value to save

Returns
  Reference to VARIANT successor in array of VARIANT(s)

## operator<<() [15/15]

VARIANT & operator<< | ( | VARIANT & | v,
|  | LPCOLESTR | value )

inline

Saves value to VARIANT.

Parameters

  [out] | v | VARIANT to save value to. For performance reasons, no VariantClear is called before saving. Thus, v must not contain referenced data.
  [in] | value | Value to save

Returns
  Reference to VARIANT successor in array of VARIANT(s)

## VariantAsBoolean()

BOOL winstd::VariantAsBoolean | ( | const VARIANT * | var,
|  | BOOL | fallback = FALSE )

inline

Check VARIANT value for boolean value.

Parameters

  [in] | var | Pointer to VARIANT value
  [in] | fallback | Value to return, for non-boolean and non-numeric VARIANT types.

Returns
  TRUE if var is VT_BOOL and not VARIANT_FALSE, or VT_<numeric> and not zero; FALSE if var is VT_BOOL and VARIANT_FALSE, or VT_<numeric> and zero; fallback otherwise.

## VariantAsInteger()

template<class T >

T winstd::VariantAsInteger | ( | const VARIANT * | var,
|  | T | fallback = 0 )

Check VARIANT value for integer value.

Template Parameters

  T | Integral type

Parameters

  [in] | var | Pointer to VARIANT value
  [in] | fallback | Value to return, for non-integral types.

Returns
  Value of VARIANT if integral; fallback otherwise.