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


C++ COleVariant函数代码示例

本文整理汇总了C++中COleVariant函数的典型用法代码示例。如果您正苦于以下问题:C++ COleVariant函数的具体用法?C++ COleVariant怎么用?C++ COleVariant使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了COleVariant函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: COleVariant

//VT_R8  
int IllusionExcelFile::GetCellInt(long irow, long icolumn)
{
    int num;
    COleVariant vresult;

    if (already_preload_ == FALSE)
    {
        CRange range;
        range.AttachDispatch(excel_current_range_.get_Item(COleVariant((long)irow), COleVariant((long)icolumn)).pdispVal, true);
        vresult = range.get_Value2();
        range.ReleaseDispatch();
    }
    else
    {
        long read_address[2];
        VARIANT val;
        read_address[0] = irow;
        read_address[1] = icolumn;
        ole_safe_array_.GetElement(read_address, &val);
        vresult = val;
    }
    //  
    num = static_cast<int>(vresult.dblVal);

    return num;
}
开发者ID:dingpf08,项目名称:sharedptr,代码行数:27,代码来源:IllusionExcelFile.cpp

示例2: ShowInExcel

//关闭打开的Excel 文件,默认情况不保存文件  
void IllusionExcelFile::CloseExcelFile(BOOL if_save)
{
    //如果已经打开,关闭文件  
    if (open_excel_file_.IsEmpty() == FALSE)
    {
        //如果保存,交给用户控制,让用户自己存,如果自己SAVE,会出现莫名的等待  
        if (if_save)
        {
            ShowInExcel(TRUE);
        }
        else
        {
            //  
            excel_work_book_.Close(COleVariant(short(FALSE)), COleVariant(open_excel_file_), covOptional);
            excel_books_.Close();
        }
        //打开文件的名称清空  
        open_excel_file_.Empty();
    }
    excel_current_range_.ReleaseDispatch();
    excel_work_sheet_.ReleaseDispatch();
    excel_sheets_.ReleaseDispatch();
    excel_work_book_.ReleaseDispatch();
    excel_books_.ReleaseDispatch();
}
开发者ID:dingpf08,项目名称:sharedptr,代码行数:26,代码来源:IllusionExcelFile.cpp

示例3: mesage_SetPathValue

int mesage_SetPathValue(lua_State* L)
{
	CString type = luaL_typename(L,3);
	if(type == "string")
	{
		CString str = luaL_checkstring(L,3);
		COleDateTime dt;
		if(dt.ParseDateTime(str))
		{
			cmessage_arg(L,"mesage_SetPathValue")->SetDatumByPath(luaL_checkstring(L,2),COleVariant(dt));
		}else{
			cmessage_arg(L,"mesage_SetPathValue")->SetDatumByPath(luaL_checkstring(L,2),COleVariant(str));
		}
	}else if(type == "number")
	{
		cmessage_arg(L,"mesage_SetPathValue")->SetDatumByPath(luaL_checkstring(L,2),COleVariant(luaL_checknumber(L,3)));
	}else if(type == "boolean")
	{
		VARIANT var;
		var.vt = VT_BOOL;
		var.boolVal = (lua_toboolean(L,3)==1);
		cmessage_arg(L,"mesage_SetPathValue")->SetDatumByPath(luaL_checkstring(L,2),var);
	}else if(type == "nil")
	{
		VARIANT var;
		var.vt = VT_NULL;
		cmessage_arg(L,"mesage_SetPathValue")->SetDatumByPath(luaL_checkstring(L,2),var);
	}else
	{
		throw_L_error(L, "Invalid type of value");
	}
	return 0;
}
开发者ID:mwoz,项目名称:Hildim.Source,代码行数:33,代码来源:mblua.cpp

示例4: strURL

HRESULT CHtmlCtrl::Navigate(LPCTSTR lpszURL, 
			    DWORD dwFlags /*= 0*/,
			    LPCTSTR lpszTargetFrameName /*= NULL*/,
			    LPCTSTR lpszHeaders /*= NULL*/, 
			    LPVOID lpvPostData /*= NULL*/,
			    DWORD dwPostDataLen /*= 0*/)
{
    CString strURL(lpszURL);
    BSTR bstrURL = strURL.AllocSysString();

    COleSafeArray vPostData;
    if (lpvPostData != NULL)
    {
        if (dwPostDataLen == 0)
            dwPostDataLen = lstrlen((LPCTSTR) lpvPostData);

        vPostData.CreateOneDim(VT_UI1, dwPostDataLen, lpvPostData);
    }

    return m_pBrowser->Navigate(bstrURL,
        COleVariant((long) dwFlags, VT_I4),
        COleVariant(lpszTargetFrameName, VT_BSTR),
        vPostData,
        COleVariant(lpszHeaders, VT_BSTR));
}
开发者ID:hpc,项目名称:mvapich-cce,代码行数:25,代码来源:HtmlCtrl.cpp

示例5: spDoc

void CDownloads_Opinions_WBEvents::RetrieveLinkToUsText(IDispatch *pdDoc)
{
	IHTMLDocument2Ptr spDoc (pdDoc);
	ASSERT (spDoc != NULL);
	IHTMLElementCollectionPtr spelForms;
	spDoc->get_forms (&spelForms);
	if (spelForms == NULL)
		return;	

	long cForms = 0;
	spelForms->get_length (&cForms);
	for (long i = 0; i < cForms; i++)
	{
		IDispatchPtr spdel;
		spelForms->item (COleVariant (i), COleVariant (i), &spdel);
		ASSERT (spdel != NULL);
		IHTMLFormElementPtr spForm (spdel);
		ASSERT (spForm != NULL);

		

		bool bFound;
		
		CString str = GetFormInputElementText (spForm, "LINKTOUSTEXT", bFound);
		if (bFound)
			_App.View_SpreadHelpDialog_LinkToUsText (str); 
		
		str = GetFormInputElementText (spForm, "RADIOBUTTON1TEXT", bFound);
		if (bFound)
			_App.View_SpreadHelpDialog_RadioButton1Text (str);
		str = GetFormInputElementText (spForm, "RADIOBUTTON2TEXT", bFound);
		if (bFound)
			_App.View_SpreadHelpDialog_RadioButton2Text (str);
	}
}
开发者ID:HackLinux,项目名称:Free-Download-Manager-vs2010,代码行数:35,代码来源:Downloads_Opinions_WBEvents.cpp

示例6: COleVariant

void IllusionExcelFile::FreezePanes(const TCHAR* cell){
	CRange range = excel_work_sheet_.get_Range(COleVariant(cell), COleVariant(cell));
	range.Select();
	CWindow0 mwin = excel_application_.get_ActiveWindow();
	mwin.put_FreezePanes(1);
	range.ReleaseDispatch();
}
开发者ID:dinfast123,项目名称:Atten,代码行数:7,代码来源:IllusionExcelFile.cpp

示例7: covOptional

void Cwhu_FaxSettingDlg::Lin_ImportAutoForArr(CString m_FilePath,CStringArray &m_AutoForward)
{
	int Number = 0;
	//m_DutyArr数组必须足够大//
	//导入
	CApplication app;
	CWorkbook book;
	CWorkbooks books;
	CWorksheet sheet;
	CWorksheets sheets;
	CRange range;
	LPDISPATCH lpDisp;
	//定义变量//
	COleVariant covOptional((long)
		DISP_E_PARAMNOTFOUND,VT_ERROR);
	if (!app.CreateDispatch(_T("Excel.Application")))
	{
		this->MessageBox(_T("无法创建Excel应用"));
	}
	books = app.get_Workbooks();
	//打开Excel,其中m_FilePath为Excel表的路径名//
	lpDisp = books.Open(m_FilePath,covOptional
		,covOptional,covOptional,covOptional
		,covOptional,covOptional,covOptional
		,covOptional,covOptional,covOptional
		,covOptional,covOptional,covOptional
		,covOptional);
	book.AttachDispatch(lpDisp);
	sheets = book.get_Worksheets();
	sheet = sheets.get_Item(COleVariant((short)1));
	
	CStringArray m_ContentArr;
	for (int ItemNum = 2;ItemNum<40;ItemNum++)
	{
		
		for (int ColumNum=1;ColumNum<11;ColumNum++)
		{
			CString m_pos = Lin_GetEnglishCharacter(ColumNum);
			CString m_Itempos;
			m_Itempos.Format(_T("%d"),ItemNum);
			CString m_str = m_pos+m_Itempos;
			range = sheet.get_Range(COleVariant(m_str),COleVariant(m_str));
			//获得单元格的内容
			COleVariant rValue;
			rValue = COleVariant(range.get_Value2());
			//转换成宽字符//
			rValue.ChangeType(VT_BSTR);
			//转换格式,并输出//
			CString m_content = CString(rValue.bstrVal);
			if (m_content!=_T(""))
			{
				m_AutoForward.Add(m_content);
			}
		}
	}
	book.put_Saved(TRUE);
	app.Quit();
}
开发者ID:ShelmyLin,项目名称:whu_VoiceCard,代码行数:58,代码来源:Cwhu_FaxSettingDlg.cpp

示例8: new_value

void CExcelFile::SetCellInt(long irow, long icolumn,int new_int)
{
    COleVariant new_value((long)new_int);
    
    CRange start_range = excel_work_sheet_.get_Range(COleVariant(_T("A1")),covOptional);
    CRange write_range = start_range.get_Offset(COleVariant((long)irow -1),COleVariant((long)icolumn -1) );
    write_range.put_Value2(new_value);
    start_range.ReleaseDispatch();
    write_range.ReleaseDispatch();
}
开发者ID:RTCSD15,项目名称:Team1,代码行数:10,代码来源:excel.cpp

示例9: new_value

void IllusionExcelFile::SetCelltime(long irow, long icolumn, time_t new_time)
{
    COleVariant new_value((COleDateTime)new_time);

    CRange start_range = excel_work_sheet_.get_Range(COleVariant("A1"), covOptional);
    CRange write_range = start_range.get_Offset(COleVariant((long)irow - 1), COleVariant((long)icolumn - 1));
    write_range.put_Value2(new_value);
    start_range.ReleaseDispatch();
    write_range.ReleaseDispatch();
}
开发者ID:dingpf08,项目名称:sharedptr,代码行数:10,代码来源:IllusionExcelFile.cpp

示例10: varBMark

BOOL CmyWord::Goto( const CString& strBMark )
{
	COleVariant varBMark(strBMark);		//设置变量
	Bookmarks  bookmarks = m_wdDoc.GetBookmarks();
	if(!bookmarks.Exists((LPCTSTR)strBMark))
	{
		return FALSE;
	}
	m_wdSel.GoTo(COleVariant(short(1),VT_BOOL),COleVariant((short)0),COleVariant((short)0),varBMark);
	return TRUE;
}
开发者ID:yuechuanbingzhi163,项目名称:GDES,代码行数:11,代码来源:CmyWord.cpp

示例11: IsCellInt

//检查一个CELL是否是数值
BOOL CExcelFile::IsCellInt(long irow, long icolumn)
{
    CRange range;
    range.AttachDispatch(excel_current_range_.get_Item (COleVariant((long)irow),COleVariant((long)icolumn)).pdispVal, true);
    COleVariant vResult =range.get_Value2();
    //好像一般都是VT_R8
    if(vResult.vt == VT_INT || vResult.vt == VT_R8)       
    {
        return TRUE;
    }
    return FALSE;
}
开发者ID:RTCSD15,项目名称:Team1,代码行数:13,代码来源:excel.cpp

示例12: varBMark_del

void CmyWord::UpdateField(CString strBMark)
{
	COleVariant varBMark_del(strBMark);		//设置变量
	Bookmarks  bookmarks = m_wdDoc.GetBookmarks();
	if(!bookmarks.Exists((LPCTSTR)strBMark))
	{
		return;
	}
	m_wdSel.GoTo(COleVariant(short(1),VT_BOOL),COleVariant((short)0),COleVariant((short)0),varBMark_del);
	Fields fields = Fields(m_wdSel.GetFields());
	fields.Update();
	bookmarks.ReleaseDispatch();
}
开发者ID:yuechuanbingzhi163,项目名称:GDES,代码行数:13,代码来源:CmyWord.cpp

示例13: ASSERT

void CHtmlView::Navigate2(LPITEMIDLIST pIDL, DWORD dwFlags /* = 0 */,
	LPCTSTR lpszTargetFrameName /* = NULL */)
{
	ASSERT(m_pBrowserApp != NULL);

	COleVariant vPIDL(pIDL);
	COleVariant empty;

	m_pBrowserApp->Navigate2(vPIDL,
		COleVariant((long) dwFlags, VT_I4),
		COleVariant(lpszTargetFrameName, VT_BSTR),
		empty, empty);
}
开发者ID:Rupan,项目名称:winscp,代码行数:13,代码来源:viewhtml.cpp

示例14: AfxMessageBox

void CEx24dView::OnClockoleLoad() 
{
   if(!m_clock.CreateDispatch("Ex24c.Document")) {
		AfxMessageBox("Ex24c.Document component not found");
		return;
   }
   m_clock.SetFigure(0, COleVariant("XII"));
   m_clock.SetFigure(1, COleVariant("III"));
   m_clock.SetFigure(2, COleVariant("VI"));
   m_clock.SetFigure(3, COleVariant("IX"));
   OnClockoleRefreshtime();
   m_clock.ShowWin();
}
开发者ID:jiayuehua,项目名称:InsideVC,代码行数:13,代码来源:ex24dView.cpp

示例15: DeleteRow

//每次删除完一行,原来的第二行就变为了现在的第一行
void IllusionExcelFile::DeleteRow(int iRow)
{
    typedef enum  XlDeleteShiftDirection
    {
        xlShiftToLeft = -4159,
        xlShiftUp = -4162
    };
    excel_current_range_.AttachDispatch(excel_work_sheet_.get_Cells());
    excel_current_range_.AttachDispatch(excel_current_range_.get_Item(COleVariant((long)iRow),covOptional).pdispVal);
    excel_current_range_.AttachDispatch(excel_current_range_.get_EntireRow());
    excel_current_range_.Delete(COleVariant((short)xlShiftUp));//原来的第二行就变为了现在的第一行
    excel_current_range_.AttachDispatch(excel_work_sheet_.get_Cells());
}
开发者ID:dingpf08,项目名称:sharedptr,代码行数:14,代码来源:IllusionExcelFile.cpp


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