什么样的数据类型可以转化为 COleVariant类型

coobesdn 2011-06-30 11:35:56
如题,又一次我把long型转化为 COleVariant型成功了,今天确不行!
...全文
120 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
wwyyxx26 2011-07-01
  • 打赏
  • 举报
回复
马瑞卡
就想叫yoko 2011-06-30
  • 打赏
  • 举报
回复
直接强转就行了
COleVariant a = (long)100;
coobesdn 2011-06-30
  • 打赏
  • 举报
回复
COleVariant( long lSrc, VARTYPE vtSrc = VT_I4 );
有long型为啥不能转化?
赵4老师 2011-06-30
  • 打赏
  • 举报
回复
COleVariant::COleVariant
COleVariant( );

COleVariant( const VARIANT& varSrc );

COleVariant( const COleVariant& varSrc );

COleVariant( LPCVARIANT pSrc );

COleVariant( LPCTSTR lpszSrc );

COleVariant( LPCTSTR lpszSrc, VARTYPE vtSrc );

COleVariant( CString& strSrc );

COleVariant( BYTE nSrc );

COleVariant( short nSrc, VARTYPE vtSrc = VT_I2 );

COleVariant( long lSrc, VARTYPE vtSrc = VT_I4 );

COleVariant( const COleCurrency& curSrc );

COleVariant( float fltSrc );

COleVariant( double dblSrc );

COleVariant( const COleDateTime& dateSrc );

COleVariant( const CByteArray& arrSrc );

COleVariant( const CLongBinary& lbSrc );

Parameters

varSrc

An existing COleVariant or VARIANT object to be copied into the new COleVariant object.

pSrc

A pointer to a VARIANT object that will be copied into the new COleVariant object.

lpszSrc

A null-terminated string to be copied into the new COleVariant object.

vtSrc

TheVARTYPE for the new COleVariant object.

strSrc

A CString object to be copied into the new COleVariant object.

nSrc, lSrc

A numerical value to be copied into the new COleVariant object.

vtSrc

TheVARTYPE for the new COleVariant object.

curSrc

A COleCurrency object to be copied into the new COleVariant object.

fltSrc, dblSrc

A numerical value to be copied into the new COleVariant object.

dateSrc

A COleDateTime object to be copied into the new COleVariant object.

arrSrc

A CByteArray object to be copied into the new COleVariant object.

lbSrc

A CLongBinary object to be copied into the new COleVariant object.

Remarks

All of these constructors create new COleVariant objects initialized to the specified value. A brief description of each of these constructors follows.

COleVariant( ) Creates an empty COleVariant object, VT_EMPTY.


COleVariant( varSrc ) Copies an existing VARIANT or COleVariant object. The variant type is retained.


COleVariant( pSrc ) Copies an existing VARIANT or COleVariant object. The variant type is retained.


COleVariant( lpszSrc ) Copies a string into the new object, VT_BSTR (UNICODE).


COleVariant( lpszSrc, vtSrc ) Copies a string into the new object. The parameter vtSrc must be VT_BSTR (UNICODE) or VT_BSTRT (ANSI).


COleVariant( strSrc ) Copies a string into the new object, VT_BSTR (UNICODE).


COleVariant( nSrc ) Copies an 8-bit integer into the new object, VT_UI1.


COleVariant( nSrc, vtSrc ) Copies a 16-bit integer (or Boolean value) into the new object. The parameter vtSrc must be VT_I2 or VT_BOOL.


COleVariant( lSrc, vtSrc ) Copies a 32-bit integer (or SCODE value) into the new object. The parameter vtSrc must be VT_I4, VT_ERROR, or VT_BOOL.


COleVariant( curSrc ) Copies a COleCurrency value into the new object, VT_CY.


COleVariant( fltSrc ) Copies a 32-bit floating-point value into the new object, VT_R4.


COleVariant( dblSrc ) Copies a 64-bit floating-point value into the new object, VT_R8.


COleVariant( dateSrc ) Copies a COleDateTime value into the new object, VT_DATE.


COleVariant( arrSrc ) Copies a CByteArray object into the new object, VT_EMPTY.


COleVariant( lbSrc ) Copies a CLongBinary object into the new object, VT_EMPTY.
For more information, see theVARIANT andVARTYPE entries in the Platform SDK.

For more information on SCODE, seeStructure of COM Error Codes in the Platform SDK.

COleVariant Overview | Class Members | Hierarchy Chart

See Also COleVariant::operator =, CString, COleCurrency, COleDateTime

33,311

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 新手乐园
社区管理员
  • 新手乐园社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧