operator>=(const _bstr_t& str) const throw();
// low-level helper functions // bstr copy() const throw(_com_error); unsigned int length() const throw();private:
// [...private stuff omitted...]}
|
copyright © 1999 - visual c++ developers journal |
frameworks and conversions
your ideas of olechar and bstr and your understanding of the manner com handles strings should be much clearer now, but we still have to cope with type conversions to and from these somewhat special data types and the more traditional tchar, wchar and char.
atl and mfc both use the same group of macros to deal with string conversions. these macros' names follow a precise convention: the characters before the "2" indicate the original type of the variable to convert, and the characters after the "2" indicate the destination type after the conversion. the following table lists the valid symbols in a conversion macro name:
|
short name |
data type |
|
a |
lpstr, char* |
|
ole |
lpolestr |
|
t |
lptstr, tchar*
本文关键:Understanding Strings In COM
|