本文整理汇总了C++中COleSafeArray::Clear方法的典型用法代码示例。如果您正苦于以下问题:C++ COleSafeArray::Clear方法的具体用法?C++ COleSafeArray::Clear怎么用?C++ COleSafeArray::Clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类COleSafeArray
的用法示例。
在下文中一共展示了COleSafeArray::Clear方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pre_load_sheet
void pre_load_sheet(CWorksheet &sheet, COleSafeArray &safe_array)
{
///当前的操作区域
CRange excel_current_range;
excel_current_range.AttachDispatch(sheet.get_Cells(), true);
CRange used_range = sheet.get_UsedRange();
VARIANT ret_ary = used_range.get_Value2();
if (!(ret_ary.vt & VT_ARRAY)){
return;
}
safe_array.Clear();
safe_array.Attach(ret_ary);
}
示例2: ExecuteAliasScript
bool CMUSHclientDoc::ExecuteAliasScript (CAlias * alias_item,
const CString strCurrentLine)
{
if (CheckScriptingAvailable ("Alias", alias_item->dispid, alias_item->strProcedure))
return false;
if (alias_item->dispid != DISPID_UNKNOWN) // if we have a dispatch id
{
CString strType = "alias";
CString strReason = TFormat ("processing alias \"%s\"",
(LPCTSTR) alias_item->strLabel);
// get unlabelled alias's internal name
const char * pLabel = alias_item->strLabel;
if (pLabel [0] == 0)
pLabel = GetAliasRevMap () [alias_item].c_str ();
if (GetScriptEngine () && GetScriptEngine ()->IsLua ())
{
list<double> nparams;
list<string> sparams;
sparams.push_back (pLabel);
sparams.push_back ((LPCTSTR) strCurrentLine);
alias_item->bExecutingScript = true; // cannot be deleted now
GetScriptEngine ()->ExecuteLua (alias_item->dispid,
alias_item->strProcedure,
eDontChangeAction,
strType,
strReason,
nparams,
sparams,
alias_item->nInvocationCount,
alias_item->regexp);
alias_item->bExecutingScript = false; // can be deleted now
return true;
} // end of Lua
// prepare for the arguments, so far, 3 which are:
// 1. alias name,
// 2. expanded line
// 3. replacement string
// WARNING - arguments should appear in REVERSE order to what the sub expects them!
enum
{
eWildcards,
eInputLine,
eAliasName,
eArgCount, // this MUST be last
};
COleSafeArray sa; // for wildcard list
COleVariant args [eArgCount];
DISPPARAMS params = { args, NULL, eArgCount, 0 };
args [eAliasName] = pLabel;
args [eInputLine] = strCurrentLine;
// --------------- set up wildcards array ---------------------------
sa.Clear ();
// nb - to be consistent with %1, %2 etc. we will make array 1-relative
sa.CreateOneDim (VT_VARIANT, MAX_WILDCARDS, NULL, 1);
long i;
for (i = 1; i < MAX_WILDCARDS; i++)
{
COleVariant v (alias_item->wildcards [i].c_str ());
sa.PutElement (&i, &v);
}
// i should be MAX_WILDCARDS (10) now ;)
COleVariant v (alias_item->wildcards [0].c_str ()); // the whole matching line
sa.PutElement (&i, &v);
args [eWildcards] = sa;
alias_item->bExecutingScript = true; // cannot be deleted now
ExecuteScript (alias_item->dispid,
alias_item->strProcedure,
eDontChangeAction, // don't change current action
strType,
strReason,
params,
alias_item->nInvocationCount);
alias_item->bExecutingScript = false; // can be deleted now
return true;
} // end of having a dispatch ID
return false;
} // end of CMUSHclientDoc::ExecuteAliasScript