Пример #1
0
// 清空日志
void CLog::Clear()
{
	if (m_logDocument.p == NULL)
		return;

	IDispatch* tmp;
	m_logDocument->open(_T("about:blank"), variant_t(), variant_t(), variant_t(), &tmp);
	tmp->Release();
	WriteDocument(LOG_FRAME);
	GetSystemTime(&m_logStartTime);
}
Пример #2
0
    HRESULT OnKeystroke(IVMSGWrapPtr key_msg, VARIANT* pvResult)
    {
        ASSERT_RETURN_VALUE(key_msg != NULL, E_INVALIDARG);
        ASSERT_RETURN_VALUE(pvResult != NULL, E_INVALIDARG);

        MSG msg;

        msg.hwnd    = reinterpret_cast<HWND>(key_msg->Gethwnd());
        msg.message = key_msg->Getmessage();
        msg.wParam  = key_msg->GetwParam();
        msg.lParam  = key_msg->GetlParam();
        msg.pt.x    = key_msg->Getptx();
        msg.pt.y    = key_msg->Getpty();
        msg.time    = key_msg->Getposttime();

        bool result = false;

        if (CWnd::FromHandlePermanent(msg.hwnd) && IsProcessedByAddon(msg.wParam))
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
            result = true;
        }
        else
        {
            result = CWnd::WalkPreTranslateTree(NULL, &msg) != FALSE;
        }

        *pvResult = variant_t(result);
        return S_OK;
    }
Пример #3
0
void AddinUi::InstallButtons(Office::CommandBarControlsPtr menu_items, CMenu* popup_menu )
{
	// For each items in the menu,

	for (UINT i = 0; i < popup_menu->GetMenuItemCount(); ++i)
	{
		CMenu* sub_menu = popup_menu->GetSubMenu(i);

		// set item caption
		CString item_caption;
		popup_menu->GetMenuString(i, item_caption, MF_BYPOSITION);

		// create new menu item.
		Office::CommandBarControlPtr item;
		menu_items->Add(
			variant_t(long(Office::msoControlButton)), 
			vtMissing, 
			vtMissing, 
			vtMissing, 
			variant_t(true),
			&item);

		// obtain command id from menu
		UINT command_id = popup_menu->GetMenuItemID(i);

		CString caption;
		caption.LoadString(command_id);
		item->put_Caption(bstr_t(caption));

		CString parameter;
		parameter.Format(L"%d", command_id);
		item->put_Parameter(bstr_t(parameter));

		// Set unique tag, so that the command is not lost
		CString tag;
		tag.Format(L"%s_%d", ADDON_NAME, command_id);
		item->put_Tag(bstr_t(tag));

		UpdateButton(item, command_id);

		m_buttons.Add(new ClickEventRedirector(item, tag, command_id));
	}
}
Пример #4
0
	// restores a single instance of the variable
	virtual void Restore( const SaveRestoreFieldInfo_t &fieldInfo, IRestore *pRestore )
	{
		variant_t *var = (variant_t*)fieldInfo.pField;

		*var = variant_t();

		var->fieldType = (_fieldtypes)pRestore->ReadInt();

		switch ( var->fieldType )
		{
		case FIELD_VOID:
			break;
		case FIELD_BOOLEAN:	
			pRestore->ReadFields( fieldInfo.pTypeDesc->fieldName, var, NULL, variant_t::m_SaveBool, 1 );
			break;
		case FIELD_INTEGER:	
			pRestore->ReadFields( fieldInfo.pTypeDesc->fieldName, var, NULL, variant_t::m_SaveInt, 1 );
			break;
		case FIELD_FLOAT:
			pRestore->ReadFields( fieldInfo.pTypeDesc->fieldName, var, NULL, variant_t::m_SaveFloat, 1 );
			break;
		case FIELD_EHANDLE:
			pRestore->ReadFields( fieldInfo.pTypeDesc->fieldName, var, NULL, variant_t::m_SaveEHandle, 1 );
			break;
		case FIELD_STRING:
			pRestore->ReadFields( fieldInfo.pTypeDesc->fieldName, var, NULL, variant_t::m_SaveString, 1 );
			break;
		case FIELD_COLOR32:
			pRestore->ReadFields( fieldInfo.pTypeDesc->fieldName, var, NULL, variant_t::m_SaveColor, 1 );
			break;
		case FIELD_VECTOR:
		{
			variant_savevector_t Temp;
			pRestore->ReadFields( fieldInfo.pTypeDesc->fieldName, &Temp, NULL, variant_t::m_SaveVector, 1 );
			var->SetVector3D(Temp.vecSave);
			break;
		}
		case FIELD_POSITION_VECTOR:
		{
			variant_savevector_t Temp;
			pRestore->ReadFields( fieldInfo.pTypeDesc->fieldName, &Temp, NULL, variant_t::m_SavePositionVector, 1 );
			var->SetPositionVector3D(Temp.vecSave);
			break;
		}
		default:
			Warning( "Bad type %d in saved variant_t\n", var->FieldType() );
			Assert(0);
			break;
		}
	}
Пример #5
0
void AddinUi::InstallToolbar(Visio::IVApplicationPtr app)
{
	LanguageLock lock(GetAppLanguage(app));

	Office::_CommandBarsPtr cbs = app->CommandBars;

	CMenu menu;
	menu.LoadMenu(IDR_MENU);

	Office::CommandBarPtr cb;
	if (FAILED(cbs->get_Item(variant_t(ADDON_NAME), &cb)) || cb == NULL)
	{
		if (SUCCEEDED(cbs->Add(variant_t(ADDON_NAME), vtMissing, vtMissing, vtMissing, &cb)))
			cb->put_Visible(VARIANT_TRUE);
	}

	if (cb != NULL)
	{
		Office::CommandBarControlsPtr controls;
		cb->get_Controls(&controls);

		InstallButtons(controls, menu.GetSubMenu(0));
	}
}
Пример #6
0
void WordOutputProcessor::Open(CStdString sFile)
{
	Word::_ApplicationPtr pApp(L"Word.Application");
	m_WordApp = pApp;
	pApp->Visible = TRUE;
	m_WordDoc = pApp->Documents->Open(&_variant_t(sFile));
	Word::_DocumentPtr pDoc = m_WordDoc;
	pDoc->ActiveWindow->View->Type = Word::wdPrintView;
	pDoc->ActiveWindow->WindowState = Word::wdWindowStateNormal;
	pDoc->ActiveWindow->Height = 400;
	pDoc->Activate();
	Sleep(1000);
	Word::WindowPtr pWnd = pDoc->ActiveWindow;
	pWnd->LargeScroll(&vtMissing, &variant_t(100));

	m_hWndEditor = GetContainerWnd(pDoc);
	m_hWndEditor = FindWindowEx(m_hWndEditor, NULL, _T("_WwB"), NULL);
	m_hWndEditor = FindWindowEx(m_hWndEditor, NULL, _T("_WwG"), NULL);
}
Пример #7
0
void AddinUi::UpdateButtons()
{
	Office::_CommandBarsPtr cbs = theApp.GetVisioApp()->CommandBars;

	for (size_t i = 0; i < m_buttons.GetCount(); ++i)
	{
		ClickEventRedirector* button = m_buttons[i];

		Office::CommandBarControlPtr control;
		cbs->FindControl(vtMissing, vtMissing, variant_t(button->m_tag), vtMissing, &control);

		if (control != button->m_punk)
		{
			button->DispEventUnadvise(button->m_punk);
			button->m_punk = control;
			button->DispEventAdvise(button->m_punk);
		}

		UpdateButton(control, button->m_cmd_id);
	}
}
Пример #8
0
/////////////////////////////////////////////////////////////////////////////
// AdaptorInfo()
//
// The function is used to elicit relevant info about the current HW..
//..configuration from the HW API.
//  The info to extract is:
//..1)number of boards installed
//..2)board names
//..3)supported subsystems (AnalogInput, AnalogOutput, DigitalIO)
// The function is called by the engine in response to the ML user..
//..command DAQHWINFO 
/////////////////////////////////////////////////////////////////////////////
HRESULT Cadvantechadapt::AdaptorInfo(IPropContainer * Container)
{
	LONG lDriverHandle = (LONG)NULL;          // driver handle
	PT_DeviceGetFeatures ptDevFeatures;		// Devfeatures table
	DEVFEATURES DevFeatures;					// structure for device features
	
	int i = 0;          // Index variable
	
	// Get the name of the adaptor module
	TCHAR name[256];
	GetModuleFileName(_Module.GetModuleInstance(),name,256); // null returns MATLAB version (non existant)
	RETURN_HRESULT(Container->put_MemberValue(L"adaptordllname",CComVariant(name)));
	
	// Place the adaptor name in the appropriate struct in the engine.
	RETURN_HRESULT(Container->put_MemberValue(L"adaptorname",variant_t(ConstructorName)));
	
	// Find board IDs
	// Start by obtaining the DeviceList. Not stored.
	short numDevices;			// Number of devices
	DEVLIST deviceList[MaxDev]; // Space to store device information.
	CComVariant var;			// General CComVariant to return info to adaptor engine.
	RETURN_ADVANTECH(DRV_DeviceGetList((DEVLIST far *)&deviceList[0], MaxDev, &numDevices));
	
	// Create storage for board IDs, bord names and constructors.
	TSafeArrayVector<CComBSTR> IDs;			// Create A SafeArrayVector to store the IDs in
	IDs.Allocate(numDevices);				// Allocate the memory for the number of devices
	TSafeArrayVector<CComBSTR> Names;		// Create A SafeArrayVector to store the Names in
	Names.Allocate(numDevices);				// Allocate the memory for the number of devices
	SAFEARRAY *ps;							// SafeArray for the subsystem support [nDx3 CComBStrs]
	CComBSTR *subsystems;
	SAFEARRAYBOUND arrayBounds[2]; 
	arrayBounds[0].lLbound = 0;
	arrayBounds[0].cElements = numDevices;    
	arrayBounds[1].lLbound = 0;
	arrayBounds[1].cElements = 3;			// AnalogInput, AnalogOutput, DigitalIO subsystems.
	ps = SafeArrayCreate(VT_BSTR, 2, arrayBounds);
	if (ps==NULL)
		return E_FAIL;      
	
	// Set up the variant to contain subsystem constructor SafeArray
	var.parray = ps;
	var.vt = VT_ARRAY | VT_BSTR;
	HRESULT hRes = SafeArrayAccessData(ps, (void **)&subsystems);
	if (FAILED (hRes)) 
	{
		SafeArrayDestroy (ps);
		return hRes;
	}
	
	// Now loop through each device, getting the ID, BoardName and subsystem support.
	wchar_t str[40];
	for (i=0; i < numDevices; i++)
	{
		// Allocate the ID
		char* string;
		string = new char[20];
		_ltoa(deviceList[i].dwDeviceNum, string, 10);
		IDs[i] = CComBSTR(string);
		
		// Open Device
		RETURN_ADVANTECH(DRV_DeviceOpen(deviceList[i].dwDeviceNum,(LONG far *)&lDriverHandle));
		
		// Get BoardNames info
		Names[i] = CComBSTR(deviceList[i].szDeviceName);
		
		// Check to see which subsystems the current board supports.
		// Get device features
		ptDevFeatures.buffer = (LPDEVFEATURES)&DevFeatures;
		ptDevFeatures.size = sizeof(DEVFEATURES);
		RETURN_ADVANTECH(DRV_DeviceGetFeatures(lDriverHandle, (LPT_DeviceGetFeatures)&ptDevFeatures));
		if ((DevFeatures.usMaxAIDiffChl + DevFeatures.usMaxAISiglChl) > 0) 
		{
			swprintf(str, L"analoginput('%s',%s)", (wchar_t*)ConstructorName, (wchar_t*)IDs[i]);
			subsystems[i]=str;
		}
		if (DevFeatures.usMaxAOChl > 0)
		{
			swprintf(str, L"analogoutput('%s',%s)", (wchar_t*)ConstructorName, (wchar_t*)IDs[i]);
			subsystems[i + numDevices]=str;
		}
		if ((DevFeatures.usMaxDIChl + DevFeatures.usMaxDOChl) > 0)
		{
			swprintf(str, L"digitalio('%s',%s)",(wchar_t*) ConstructorName, (wchar_t*)IDs[i]);
			subsystems[i + 2*numDevices] = str;
		}  
		// Close device
		RETURN_ADVANTECH(DRV_DeviceClose((LONG far *)&lDriverHandle));
	}
	
	// Return Object Constructor Names since they're in var already.
	SafeArrayUnaccessData (ps);    
	RETURN_HRESULT(Container->put_MemberValue(L"objectconstructorname",var));
	
	// Return the board names
	var.Clear();			// resuse the same 'var' variable for the boardnames.
	Names.Detach(&var);
	RETURN_HRESULT(Container->put_MemberValue(L"boardnames",var));
	
	// Return the board numbers
	var.Clear();			//reuse the same 'var' variable for the IDs[]
	IDs.Detach(&var);
	RETURN_HRESULT(Container->put_MemberValue(L"installedboardids",var));   
	
	return S_OK;
} // end of AdaptorInfo()
Пример #9
0
Файл: main.cpp Проект: imace/nnt
static void test_database()
{
    // connect sqlite.
    if (0)
    {
        store::Sqlite sqlite;
        store::connection_info info;
        info.url = "sqlite.db";
        sqlite.connect(info);
        
        store::datatable_t* dt = NULL;
        
        if (1)
        {
            dt = sqlite.exec("select * from TEST");
            trace_msg(dt->to_string());
            dt->drop();
        }
        
        if (1)
        {
            dt = sqlite.exec("select * from TEST where ID = :id",
                             core::push_back<store::Sqlite::params_type>(
                                                                         core::make_pair(":id", variant_t(1))
                                                                         ));
            trace_msg(dt->to_string());
            dt->drop();
        }
    }
    
    if (1)
    {        
        store::Sqlite sqlite;
        sqlite.creatable = true;
        sqlite.readonly = false;
        store::connection_info info;
        info.url = "sqlite-new.db";
        sqlite.connect(info);
        sqlite.set_key("abcdef");
        store::datatable_t* dt = NULL;
        dt = sqlite.exec("create table test (id integer, name text)");
        if (dt) dt->drop();
        sqlite.exec("insert into test (id, name) values (1, 'test')")->drop();
        dt = sqlite.exec("select * from test");
        trace_msg(dt->to_string());
        dt->drop();
    }
    
    // connect mysql.
    if (0)
    {
        store::MySql mysql;
        store::connection_info info;
        info.url = "localhost";
        info.user = "******";
        info.passwd = "root";
        info.database = "test";
        mysql.connect(info);
        
        store::datatable_t* dt = NULL;
        
        if (1)
        {
            dt = mysql.exec("select * from test");
            trace_msg(dt->to_string());
            dt->drop();
        }
        
        if (1)
        {
            dt = mysql.exec("select * from test where test = ?", 
                            core::push_back<store::MySql::params_type>(
                                                                       core::make_pair("", variant_t(1))
                                                                       ));
            //dt = mysql.exec("select * from test where test = 1", store::MySql::params_type());
            trace_msg(dt->to_string());
            dt->drop();
        }
    }
    
    // connect sqlserver.
    if (0)
    {
        store::SqlServer sqlsrv;
        store::connection_info info;
        info.url = "wybo-win";
        info.user = "******";
        info.passwd = "test";
        info.database = "TEST";
        sqlsrv.connect(info);
        
        store::datatable_t* dt = NULL;
        
        if (1)
        {
            dt = sqlsrv.exec("select * from TEST");
            trace_msg(dt->to_string());
            dt->drop();
        }
        
        if (1)
        {
            dt = sqlsrv.exec("select * from TEST where ID = @id; select * from TEST where NAME = @name;", 
                             core::push_back<store::MySql::params_type>(
                                                                        core::make_pair("id", variant_t(1)),
                                                                        core::make_pair("name", variant_t("DDDDD", core::assign))
                                                                        ));
            store::datatable_t* next = dt;
            while (next)
            {
                trace_msg(next->to_string());
                next = next->next;
            }
            dt->drop();
        }
    }
    
    // connect postgresql.
    if (0)
    {
        store::PostgreSql pgsql;
        store::connection_info info;
        info.url = "localhost:5432";
        info.user = "******";
        info.passwd = "root";
        info.database = "postgres";
        pgsql.connect(info);
        
        store::datatable_t* dt = NULL;
        
        if (0)
        {
            dt = pgsql.exec("select * from \"TEST\"");
            trace_msg(dt->to_string());
            dt->drop();
        }
        
        if (1)
        {
            dt = pgsql.exec("select * from \"TEST\" where \"TEST\".\"ID\" = $1::int4",
                            core::push_back<store::PostgreSql::params_type>(
                                                                            core::make_pair("", variant_t(1))
                                                                            ));
            trace_msg(dt->to_string());
            dt->drop();
        }
    }
    
    // connect bdb.
    if (0)
    {
        store::test::Bdb ca;
        ut::Suite su;
        su.add(&ca);
        su.run();
    }
}
Пример #10
0
HRESULT CbRoot::SetBaseHwInfo()
{
    CComPtr<IProp> prop;        

    char tmpString[512];
    
    // we expect the ini file to be in the same directory as the application,
    // namely, this DLL. It's the only way to find the file if it's not
    // in the windows subdirectory

    if (GetModuleFileName(_Module.GetModuleInstance(), tmpString, 512)==0)
        return E_FAIL;
    // replace .dll with .ini
    strrchr(tmpString, '.' )[1]='\0';
    strcat(tmpString,"ini"); 
    _iniFileName=tmpString;


    cbGetBoardName(_BoardNum,tmpString);
    ATLTRACE2(MCC_UL_CALL,3,"cbGetBoardName(_BoardNum = %i, tmpString); result tmpString = %s\n",_BoardNum,tmpString);
    _boardName=tmpString;
    _iniSection=_boardName;  

    CBI_CHECK(cbGetConfig(BOARDINFO, _BoardNum, 0, BIBOARDTYPE, &_BoardType));
    ATLTRACE2(MCC_UL_CALL,3,"cbGetConfig (BOARDINFO,_BoardNum = %d,0,BIBOARDTYPE, &_BoardType); result: _BoardType=%d\n",_BoardNum,_BoardType);
    long id=GetFromIni(_T("ID"),0L);
    if (id==0)
    {
        _engine->WarningMessage(CComBSTR("Board not found in mwmcc.ini file.  Board is not supported but may work.")); 
    }
    // Check to see if this is a DEMO-BOARD (code 45)
    else if (_BoardType == 45)
    {
        // Geck 224706:  When people create a DEMO-BOARD device, they probably didn't mean to.
        // Give them a warning to indicate that they might want to recosider this.
        _engine->WarningMessage(CComBSTR("The ID value selected is associated with Measurement Computing's virtual DEMO-BOARD. This virtual software device provides simulated data for demo purposes. Use a different ID if this was not your intent."));
    }
    else if (id!=_BoardType)
    {
        _engine->WarningMessage(CComBSTR("BoardType from Ini file does not match that returned from universal libray."));
        _RPT2(_CRT_WARN,"BoardType from ini file is %d board type from unilib is %d\n",id,_BoardType);
    }
    

    // device Id
    wchar_t Str[80];
    swprintf(Str, L"%d", _BoardNum);
    DEBUG_HRESULT(_DaqHwInfo->put_MemberValue(CComBSTR(L"id"), CComVariant(Str)));		
    DEBUG_HRESULT(_DaqHwInfo->put_MemberValue(CComBSTR(L"adaptorname"), CComVariant(L"mcc")));

    DEBUG_HRESULT(_DaqHwInfo->put_MemberValue(CComBSTR(L"vendordriverdescription"),
	CComVariant(L"Measurement Computing Universal Library")));
    
    
    // Get the UL Revision numbers
    float DllRevNum, DriverRevNum;
    
	cbGetRevision (&DllRevNum, &DriverRevNum);
    ATLTRACE2(MCC_UL_CALL,3,"cbGetRevision (&DllRevNum,&DriverRevNum); result: DllRevNum=%d,DriverRevNum=%d\n",DllRevNum,DriverRevNum);

	// Make a call to get the decimal (.xxx) value of the minor revision number.
	// Add this to the major revision number (y.xxx)
	DllRevNum += GetDriverMinorRevision();

	CComVariant var = DllRevNum;
	var.ChangeType(VT_BSTR);

    DEBUG_HRESULT( _DaqHwInfo->put_MemberValue(CComBSTR(L"vendordriverversion"), var));

    DEBUG_HRESULT(_DaqHwInfo->put_MemberValue(CComBSTR(L"devicename"),variant_t(_boardName)));
    
    return S_OK;
}
BUSINESSPRINT_API long __stdcall BusinessInfoPrint(TBusinessInfo businessInfo)
{
    //模块路径
    TCHAR szModuleFileName[MAX_PATH];
    if (FALSE == GetModuleFileName(NULL, szModuleFileName, MAX_PATH))
    {
        OutputDebugString(TEXT("获取模块路径失败\r\n"));
        return 1;
    }

    //模板全文件名
    TCHAR szExcelTemplate[MAX_PATH];
    _sntprintf_s(szExcelTemplate, _countof(szExcelTemplate), TEXT("%s/../BusinessInfoTemplate.xls"), szModuleFileName);

    //临时文件名
    //TCHAR szTempPath[MAX_PATH];
    //TCHAR szTempFileName[MAX_PATH];
    //srand(GetCurrentTime());
    //_sntprintf_s(szTempFileName, _countof(szTempFileName), TEXT("%s/../%d_%d_%d.xls"), 
    //    szModuleFileName, GetTickCount(), rand() % 32767, time(NULL));

    //复制模板到临时文件
    //if (FALSE == CopyFile(szExcelTemplate, szTempFileName, FALSE))
    //{
    //    OutputDebugString(TEXT("获取模板到临时文件失败\r\n"));
    //    return 3;
    //}


    BOOL bReturn = S_OK;
    CExcelDocument document;

    //打开模板
    if (S_OK == bReturn)
    {
        try
        {
            if (FALSE == document.Open(szExcelTemplate))
            {
                bReturn = 2;
            }
        }
        catch (...)
        {
            OutputDebugString(TEXT("打开模板异常\r\n"));
            bReturn = 3;
        }
    }

    //写入交易信息
    if (S_OK == bReturn)
    {
        try
        {
            //客户姓名
            document.m_range.put_Item(variant_t(2), variant_t(2), variant_t(businessInfo.szCustomName));

            //身份证
            document.m_range.put_Item(variant_t(3), variant_t(2), variant_t(businessInfo.szCustomId));

            //卡号/账号
            document.m_range.put_Item(variant_t(4), variant_t(2), variant_t(businessInfo.szCustomBankAccout));

            //业务类型
            document.m_range.put_Item(variant_t(5), variant_t(2), variant_t(businessInfo.szBusinessType));

            //产品编号
            document.m_range.put_Item(variant_t(6), variant_t(2), variant_t(businessInfo.szProductId));

            //交易时间
            document.m_range.put_Item(variant_t(7), variant_t(2), variant_t(businessInfo.szBusinessTime));

            //营业网点名称
            document.m_range.put_Item(variant_t(8), variant_t(2), variant_t(businessInfo.szBankName));

            //业务员姓名
            document.m_range.put_Item(variant_t(9), variant_t(2), variant_t(businessInfo.szBankEmployeeName));

            //产品名称
            document.m_range.put_Item(variant_t(5), variant_t(4), variant_t(businessInfo.szProductName));

            //业务单号
            document.m_range.put_Item(variant_t(6), variant_t(4), variant_t(businessInfo.szBusinessId));

            //产品购买周期
            document.m_range.put_Item(variant_t(7), variant_t(4), variant_t(businessInfo.szProductPeriod));

            //营业网点编号
            document.m_range.put_Item(variant_t(8), variant_t(4), variant_t(businessInfo.szBankId));

            //业务员编号
            document.m_range.put_Item(variant_t(9), variant_t(4), variant_t(businessInfo.szBankEmployeeId));

            //Excel 形状接口
            CShapes shapes;
            LPDISPATCH lpDisShapes = document.m_worksheet.get_Shapes();
            shapes.AttachDispatch(lpDisShapes);

            //录像开始截图位置
            CRange rangeA11 = document.m_worksheet.get_Range(variant_t(TEXT("A11")), document.m_missing);
            CRange rangeB22 = document.m_worksheet.get_Range(variant_t(TEXT("B22")), document.m_missing);
            double leftA11 = rangeA11.get_Left().dblVal + PIC_MARGIN;
            double topA11 = rangeA11.get_Top().dblVal + PIC_MARGIN;
            double imageWidth = rangeA11.get_Width().dblVal + rangeB22.get_Width().dblVal - PIC_MARGIN * 2;
            double imageHeight = (rangeB22.get_Top().dblVal + rangeB22.get_Height().dblVal) - rangeA11.get_Top().dblVal - PIC_MARGIN * 2;

            //添加录像开始截图
            CShape shape1 = shapes.AddPicture(businessInfo.szSnapshotBegin, 0, 1, 
                leftA11, topA11, imageWidth, imageHeight);

            //录像结束截图位置
            CRange rangeC11 = document.m_worksheet.get_Range(variant_t(TEXT("C11")), document.m_missing);
            CRange rangeD22 = document.m_worksheet.get_Range(variant_t(TEXT("D22")), document.m_missing);
            double leftC11 = rangeC11.get_Left().dblVal + PIC_MARGIN;
            double topC11 = rangeC11.get_Top().dblVal + PIC_MARGIN;
            double imageWidth2 = rangeC11.get_Width().dblVal + rangeD22.get_Width().dblVal - PIC_MARGIN * 2;
            double imageHeight2 = (rangeD22.get_Top().dblVal + rangeD22.get_Height().dblVal) - rangeC11.get_Top().dblVal - PIC_MARGIN * 2;

            //添加录像结束截图
            CShape shape2 = shapes.AddPicture(businessInfo.szSnapshotEndp, 0, 1, 
                leftC11, topC11, imageWidth2, imageHeight2);

            shapes.ReleaseDispatch();
            rangeA11.ReleaseDispatch();
            rangeB22.ReleaseDispatch();
            rangeC11.ReleaseDispatch();
            rangeD22.ReleaseDispatch();
            shape1.ReleaseDispatch();
            shape2.ReleaseDispatch();
        }
        catch (...)
        {
            OutputDebugString(TEXT("写入交易信息异常\r\n"));
            bReturn = 4;
        }
    }

    //打印
    if (S_OK == bReturn)
    {
        try
        {
            document.m_worksheet.PrintOut(variant_t(1), variant_t(1), variant_t(1), variant_t((short) FALSE), 
                document.m_missing, variant_t((short) FALSE), variant_t((short) FALSE), document.m_missing);
        }
        catch (...)
        {
            OutputDebugString(TEXT("打印异常\r\n"));
            bReturn = 5;
        }
    }

    //关闭释放文档
    try
    {
        document.Close(FALSE);
    }
    catch (COleDispatchException * pEx)
    {
        OutputDebugString(pEx->m_strDescription);
    }
    catch (...)
    {
        OutputDebugString(TEXT("关闭文档异常\r\n"));
    }

    return bReturn;
}
Пример #12
0
void CSDKPlayer::Event_Killed( const CTakeDamageInfo &info )
{
	BaseClass::Event_Killed( info );

	FirePlayerProxyOutput( "PlayerDied", variant_t(), this, this );
}