當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。