当前位置: 首页>>代码示例>>C++>>正文


C++ COleSafeArray::Clear方法代码示例

本文整理汇总了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); 
	}
开发者ID:no2key,项目名称:tokit,代码行数:16,代码来源:excel_tool.cpp

示例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
开发者ID:WillFa,项目名称:mushclient,代码行数:91,代码来源:evaluate.cpp


注:本文中的COleSafeArray::Clear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。