|
|||||
| | |||||
|
A char is 1 bytes An int is 4 bytes A short is 2 bytes A long is 4 bytes An unsigned char is 1 bytes An unsigned int is 4 bytes An unsigned short is 2 bytes An unsigned long is 4 bytes A float is 4 bytes A double is 8 bytes |
| strings |
|---|
A length-prefixed string used by Automation data manipulation functions. It has been described both as typedef OLECHAR *BSTR; and typedef LPWSTR. It is just a LPWSTR with the string length prefixed onto the string, taking up the first ULONG bytes.
BSTRs are wide, double-byte (Unicode) strings on 32-bit Windows
You create a string with SysAllocString.
And you release it with SysFreeString.
to get the length of a BSTR pass it to SysStringLen.
you changes the BSTR with SysReAllocString().
There are no functions to manipulate a sub-string within a BSTR...
compare javascript:
subst('Quiet lulls the peaceful mind', 'l', 'XX') Results:Quiet XXuXXXXs the peacefuXX mind subst('Quiet lulls the peaceful mind', 'l', 'll') Results:Quiet llulllls the peacefull mind substring( aStartIndex, anEndIndex) Returns the characters found between the start and end indices, e.g., string1 + string2 Creates a new string which appends string1 with string2, e.g., |
compare VB:
|
Convert the code to a MFC CString or an STL basic_string<> and then use a |
_bstr_t( char* s2 )
Constructs a _bstr_t object by calling SysAllocString to create a new BSTR object and encapsulate it. This constructor first performs a multibyte to Unicode conversion.
An LPCWSTR if UNICODE is defined, an LPCSTR otherwise. In other words, it is a pointer to a constant generic string.
a constant for a lpcwstr.
Pointer to a constant null-terminated string of 8-bit Windows (ANSI) characters.
Pointer to a constant null-terminated string of 16-bit Unicode characters.
A varaint is a union.
see the union how-to file in the howto/c/unions.htm directory . Books always document this data type. A Variant is based on the union type. The CComVariant type is an encapsulation of the three necessary steps in creating and using a VARIANT type.
CComBSTR();
CComBSTR(int nSize);
CComBSTR(int nSize, LPCOLESTR sz);
CComBSTR(LPCOLESTR psrc);
CComBSTR(const CComBSTR& src);
CComBSTR(REFGUID src); /*converts a GUID to a BSTR */
| Leave a Reply |