标签:
Variant V;
String mystr;
if (TVarData(V).VType == varEmpty)
ListBox1->Items->Add(L"Variants start ???? empty.");
VarClear(V);
TVarData(V).VType = varString;
mystr = L"Here is my ???? string";
wchar_t* MyBuffer = new wchar_t[mystr.Length() + 1];
StrCopy(MyBuffer, mystr.c_str());
TVarData(V).VString = MyBuffer;
mystr = (wchar_t *)(TVarData(V).VString);
ListBox1->Items->Add(L"This variant is now a ???? string: " + mystr);
VarClear(V);
TVarData(V).VType = varInteger;
TVarData(V).VInteger = 1234567;
ListBox1->Items->Add(L"This variant is now an ???? integer: " + IntToStr(TVarData(V).VInteger));
http://docwiki.embarcadero.com/CodeExamples/XE7/en/SystemVarClear_%28C%2B%2B%29
标签:
原文地址:http://www.cnblogs.com/cb168/p/4275146.html