本文整理汇总了C++中TSTR::ToMaxString方法的典型用法代码示例。如果您正苦于以下问题:C++ TSTR::ToMaxString方法的具体用法?C++ TSTR::ToMaxString怎么用?C++ TSTR::ToMaxString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TSTR
的用法示例。
在下文中一共展示了TSTR::ToMaxString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PutAppData
void AppDataTest::PutAppData()
{
Animatable *anim = PickAnim();
if (!anim) return;
// XRef stuff 020416 --prs.
if (s_through_xref) {
RefTargetHandle rth = (RefTargetHandle)anim;
IXRefItem* xi = NULL;
while (rth != NULL && (xi = IXRefItem::GetInterface(*rth)) != NULL)
rth = xi->GetSrcItem();
if (rth != NULL)
anim = rth;
}
// Load the text out of the edit field into a buffer
int text_len = GetWindowTextLength(GetDlgItem(hPanel,IDC_APPDATA_EDIT))+1;
TSTR theText;
theText.Resize(text_len);
GetWindowText(
GetDlgItem(hPanel,IDC_APPDATA_EDIT),
theText.dataForWrite(), text_len);
MaxSDK::Util::MaxString m_string;
theText.ToMaxString(m_string);
const char* a_string = m_string.ToUTF8();
size_t len = strlen(a_string)+4; // 3 for UTF8 BOM, one for null
char* buf = (char*)MAX_malloc(len);
strcpy(buf, "\xef\xbb\xbf"); // UTF8 BOM
strcat(buf, a_string);
// Remove the chunk if it exists
anim->RemoveAppDataChunk(
APPDATA_TEST_CLASS_ID,
UTILITY_CLASS_ID,
spin->GetIVal());
// Add a chunk
anim->AddAppDataChunk(
APPDATA_TEST_CLASS_ID,
UTILITY_CLASS_ID,
spin->GetIVal(),
(DWORD)len, buf);
}