请教,pchar类型如何转为OleVariant类型?急! ( 积分: 50 )

  • 主题发起人 主题发起人 szyc927
  • 开始时间 开始时间
S

szyc927

Unregistered / Unconfirmed
GUEST, unregistred user!
请教,pchar类型如何转为OleVariant类型?
 
请高手帮帮忙
 
没有人能回答吗?
 
OleVariant := strpas(pchar);
 
转换之后要保证OleVariant也是一个指针型的啊!
 
VarType Contents of variant
varEmpty The variant is Unassigned.
varNull The variant is Null.
varSmallint 16-bit signed integer (type Smallint in Delphi, short in C++ ).
varInteger 32-bit signed integer (type Integer in Delphi, int in C++).
varSingle Single-precision floating-point value (type Single in Delphi, float in C++).
varDouble Double-precision floating-point value (typedo
uble).
varCurrency Currency floating-point value (type Currency).
varDate Date and time value (type TDateTime).
varOleStr Reference to a dynamically allocated UNICODE string.
varDispatch Reference to an Automation object (an IDispatch interface pointer).
varError Operating system error code.
varBoolean 16-bit boolean (type WordBool).
varVariant A variant.
varUnknown Reference to an unknown object (an IInterface or IUnknown interface pointer).
varShortInt 8-bit signed integer (type ShortInt in Delphi or signed char in C++)
varByte A Byte
varWord unsigned 16-bit value (Word)
varLongWord unsigned 32-bit value (type LongWord in Delphi or unsigned long in C++)
varInt64 64-bit signed integer (Int64 in Delphi or __int64 in C++)
varStrArg COM-compatible string.
varString Reference to a dynamically allocated string (not COM compatible).
varAny A CORBA Any value.

OleVariant不支持指针类型,不同的应用程序间不要传递指针,因为内存是独立的.如果是同一个应用程序里,你可以强制把指针转为integer,用时再转回来就可以了
 
看来你对OleVariant类型理解有偏差,如果不用ysai的方法,你也可以尝试SafeArray,
至于要保证它是指针,呵呵...
 
后退
顶部