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


C++ AddDocTemplate函数代码示例

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


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

示例1: _T

BOOL CNewPasEditApp::InitInstance()
{
	m_hScintilla = ::LoadLibrary( _T("SciLexer.dll") );
	if( !m_hScintilla )
	{
		AfxMessageBox( IDS_ERR_NODLL, MB_ICONERROR );
		return FALSE;
	}

	// InitCommonControlsEx() is required on Windows XP if an application
	// manifest specifies use of ComCtl32.dll version 6 or later to enable
	// visual styles.  Otherwise, any window creation will fail.
	INITCOMMONCONTROLSEX InitCtrls;
	InitCtrls.dwSize = sizeof(InitCtrls);
	// Set this to include all the common control classes you want to use
	// in your application.
	InitCtrls.dwICC = ICC_WIN95_CLASSES;
	InitCommonControlsEx(&InitCtrls);

	CWinAppEx::InitInstance();

	// Initialize OLE libraries
	if (!AfxOleInit())
	{
		AfxMessageBox(IDP_OLE_INIT_FAILED);
		return FALSE;
	}
	AfxEnableControlContainer();

	SetRegistryKey(_T("NewPas"));
	LoadStdProfileSettings(4);  // Load standard INI file options (including MRU)

	InitKeyboardManager();

	InitTooltipManager();
	CMFCToolTipInfo ttParams;
	ttParams.m_bVislManagerTheme = TRUE;
	theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL,
		RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams);

	// Register the application's document templates.  Document templates
	//  serve as the connection between documents, frame windows and views
	CMultiDocTemplate* pDocTemplate;
	pDocTemplate = new CMultiDocTemplate(
		IDR_NewPasEditTYPE,
		RUNTIME_CLASS(CNewPasEditDoc),
		RUNTIME_CLASS(CChildFrame),       // main MDI frame window
		RUNTIME_CLASS(CNewPasEditView));
	if (!pDocTemplate)
		return FALSE;
	AddDocTemplate(pDocTemplate);

	// create main MDI Frame window
	CMainFrame* pMainFrame = new CMainFrame;
	if (!pMainFrame || !pMainFrame->LoadFrame(IDR_MAINFRAME))
	{
		delete pMainFrame;
		return FALSE;
	}
	m_pMainWnd = pMainFrame;

	// Parse command line for standard shell commands, DDE, file open
	CCommandLineInfo cmdInfo;
	ParseCommandLine(cmdInfo);

	// Dispatch commands specified on the command line.  Will return FALSE if
	// app was launched with /RegServer, /Register, /Unregserver or /Unregister.
	if (!ProcessShellCommand(cmdInfo))
		return FALSE;

	// call DragAcceptFiles only if there's a suffix
	//  In an SDI app, this should occur after ProcessShellCommand
	m_pMainWnd->DragAcceptFiles( TRUE );

	// The one and only window has been initialized, so show and update it
	m_pMainWnd->ShowWindow(SW_SHOW);
	m_pMainWnd->UpdateWindow();
	return TRUE;
}
开发者ID:valentingalea,项目名称:newpas,代码行数:79,代码来源:NewPasEdit.cpp

示例2: AfxMessageBox

BOOL cvCTestApp::InitInstance()
{
	// Initialize OLE libraries
	if (!AfxOleInit())
	{
		AfxMessageBox(IDP_OLE_INIT_FAILED);
		return FALSE;
	}

	AfxEnableControlContainer();

	// Standard initialization

#ifdef _AFXDLL
	Enable3dControls();			// Call this when using MFC in a shared DLL
#else
	Enable3dControlsStatic();	// Call this when linking to MFC statically
#endif

	// Change the registry key under which our settings are stored.
	SetRegistryKey(IDS_APPREGISTRY);

	LoadStdProfileSettings();  // Load standard INI file options (including MRU)

	// Register document templates

	CSingleDocTemplate* pDocTemplate;
	pDocTemplate = new CSingleDocTemplate(
		IDR_MAINFRAME,
		RUNTIME_CLASS(cvCTestDoc),
		RUNTIME_CLASS(cvCMainFrame),       // main SDI frame window
		RUNTIME_CLASS(cvCTestSuiteView));
	pDocTemplate->SetServerInfo(
		IDR_SRVR_EMBEDDED, IDR_SRVR_INPLACE,
		RUNTIME_CLASS(cvCInPlaceFrame));
	AddDocTemplate(pDocTemplate);
	m_server.ConnectTemplate(clsid, pDocTemplate, TRUE);

	// Parse command line for standard shell commands, DDE, file open
	CCommandLineInfo cmdInfo;
	ParseCommandLine(cmdInfo);

	if (cmdInfo.m_bRunEmbedded || cmdInfo.m_bRunAutomated)
	{
		COleTemplateServer::RegisterAll();

		// Application was run with /Embedding or /Automation.  Don't show the
		//  main window in this case.
		return TRUE;
	}

	m_server.UpdateRegistry(OAT_INPLACE_SERVER);
	COleObjectFactory::UpdateRegistryAll();

	// Dispatch commands specified on the command line
	if (!ProcessShellCommand(cmdInfo))
		return FALSE;
	m_pMainWnd->ShowWindow(SW_SHOW);
	m_pMainWnd->UpdateWindow();

	return TRUE;
}
开发者ID:dineshkummarc,项目名称:TestRunner_automation,代码行数:62,代码来源:cvCTestApp.cpp

示例3: InitializeIIDs

CGenViewerCtrl::CGenViewerCtrl()
{
	InitializeIIDs(&IID_DGenViewer, &IID_DGenViewerEvents);
	// TODO: Initialize your control's instance data here.

	SetInitialSize(200, 200);

#ifdef HOOPS
	m_pHDB=new HDB();
	m_pHDB->Init();
	m_pHDB->SetIsolatedDrivers(false);
#endif
	TCHAR cur_dir[MVO_BUFFER_SIZE];
	GetCurrentDirectory(MVO_BUFFER_SIZE, cur_dir);
	memset(m_AppDirectory,0,MVO_BUFFER_SIZE);	
	//UtC(cur_dir, m_AppDirectory);

#if defined(INTEROP) || defined(ACIS)
#ifdef ACIS
	//Base configuration must happen before unlocking ACIS.
	//   If not using initialize_base, then unlock must 
	//   happen after the initialize modeller 
	base_configuration base_config;
	logical ok = initialize_base( &base_config);
	unlock_spatial_products_4158();
#endif // ACIS


#ifdef INTEROP
	char *path;
	path = getenv("PATH");
	if (path == NULL) {
		wchar_t * error_msg = L"Unable to add CATIA V5 DLLs to the path.  CATIA V5 translation will not work.";
		AfxMessageBox(LPCTSTR(error_msg), MB_ICONSTOP);
	}
	else {
		_putenv(H_FORMAT_TEXT("PATH=%s\\lib3dx\\intel_a\\code\\bin;%s", m_AppDirectory, path));
	}
#endif // INTEROP
#endif // defined(INTEROP) || defined(ACIS)


#ifdef ACIS
	outcome o; 
	o = api_start_modeller(0);
	check_outcome(o);

	//Issue #10605: Default Entity Manager Factory no longer registered by default		
	if (get_major_version() >= 20) 
	{
		entity_mgr_factory* my_manager = new default_entity_mgr_factory();
		{
			outcome o = asmi_set_entity_mgr_factory(my_manager);
			check_outcome(o);
		}
	}

	o = api_initialize_hoops_acis_bridge();
	check_outcome(o);
	ha_rendering_options &roptions=HA_Get_Rendering_Options();
	{
		roptions.SetMergeFacesMode(TRUE);
		roptions.SetGeomPattern ("?Include Library/ACIS model geometry");
		roptions.SetPattern("entity");
	}	
#endif // ACIS

	AfxInitRichEdit();

	AddDocTemplate(new CActiveXDocTemplate(
		RUNTIME_CLASS(CGenViewerDoc),   //改为你的文档类
		RUNTIME_CLASS(CMainFrame),  //改为你的框架类
		RUNTIME_CLASS(CGenViewerView))); //改为你的视图类

}
开发者ID:binhpt,项目名称:vltest,代码行数:75,代码来源:GenViewerCtrl.cpp

示例4: sizeof

BOOL Cvc2013TestApp::InitInstance()
{
	// 응용 프로그램 매니페스트가 ComCtl32.dll 버전 6 이상을 사용하여 비주얼 스타일을
	// 사용하도록 지정하는 경우, Windows XP 상에서 반드시 InitCommonControlsEx()가 필요합니다. 
	// InitCommonControlsEx()를 사용하지 않으면 창을 만들 수 없습니다.
	INITCOMMONCONTROLSEX InitCtrls;
	InitCtrls.dwSize = sizeof(InitCtrls);
	// 응용 프로그램에서 사용할 모든 공용 컨트롤 클래스를 포함하도록
	// 이 항목을 설정하십시오.
	InitCtrls.dwICC = ICC_WIN95_CLASSES;
	InitCommonControlsEx(&InitCtrls);

	CWinAppEx::InitInstance();


	// OLE 라이브러리를 초기화합니다.
	if (!AfxOleInit())
	{
		AfxMessageBox(IDP_OLE_INIT_FAILED);
		return FALSE;
	}

	AfxEnableControlContainer();

	EnableTaskbarInteraction();

	// RichEdit 컨트롤을 사용하려면  AfxInitRichEdit2()가 있어야 합니다.	
	// AfxInitRichEdit2();

	// 표준 초기화
	// 이들 기능을 사용하지 않고 최종 실행 파일의 크기를 줄이려면
	// 아래에서 필요 없는 특정 초기화
	// 루틴을 제거해야 합니다.
	// 해당 설정이 저장된 레지스트리 키를 변경하십시오.
	// TODO: 이 문자열을 회사 또는 조직의 이름과 같은
	// 적절한 내용으로 수정해야 합니다.
	SetRegistryKey(_T("로컬 응용 프로그램 마법사에서 생성된 응용 프로그램"));
	LoadStdProfileSettings(4);  // MRU를 포함하여 표준 INI 파일 옵션을 로드합니다.


	InitContextMenuManager();

	InitKeyboardManager();

	InitTooltipManager();
	CMFCToolTipInfo ttParams;
	ttParams.m_bVislManagerTheme = TRUE;
	theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL,
		RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams);

	// 응용 프로그램의 문서 템플릿을 등록합니다.  문서 템플릿은
	//  문서, 프레임 창 및 뷰 사이의 연결 역할을 합니다.
	CMultiDocTemplate* pDocTemplate;
	pDocTemplate = new CMultiDocTemplate(IDR_vc2013TestTYPE,
		RUNTIME_CLASS(Cvc2013TestDoc),
		RUNTIME_CLASS(CChildFrame), // 사용자 지정 MDI 자식 프레임입니다.
		RUNTIME_CLASS(Cvc2013TestView));
	if (!pDocTemplate)
		return FALSE;
	AddDocTemplate(pDocTemplate);

	// 주 MDI 프레임 창을 만듭니다.
	CMainFrame* pMainFrame = new CMainFrame;
	if (!pMainFrame || !pMainFrame->LoadFrame(IDR_MAINFRAME))
	{
		delete pMainFrame;
		return FALSE;
	}
	m_pMainWnd = pMainFrame;


	// 표준 셸 명령, DDE, 파일 열기에 대한 명령줄을 구문 분석합니다.
	CCommandLineInfo cmdInfo;
	ParseCommandLine(cmdInfo);



	// 명령줄에 지정된 명령을 디스패치합니다.
	// 응용 프로그램이 /RegServer, /Register, /Unregserver 또는 /Unregister로 시작된 경우 FALSE를 반환합니다.
	if (!ProcessShellCommand(cmdInfo))
		return FALSE;
	// 주 창이 초기화되었으므로 이를 표시하고 업데이트합니다.
	pMainFrame->ShowWindow(m_nCmdShow);
	pMainFrame->UpdateWindow();

	return TRUE;
}
开发者ID:xahgo,项目名称:con2,代码行数:87,代码来源:vc2013Test.cpp

示例5: InitCommonControls

BOOL CDirstatApp::InitInstance()
{
	CWinApp::InitInstance();

	InitCommonControls();			// InitCommonControls() is necessary for Windows XP.
	VERIFY(AfxOleInit());			// For SHBrowseForFolder()
	AfxEnableControlContainer();	// For our rich edit controls in the about dialog
	VERIFY(AfxInitRichEdit());		// Rich edit control in out about box
	VERIFY(AfxInitRichEdit2());		// On NT, this helps.
	EnableHtmlHelp();

	SetRegistryKey(_T("Seifert"));
	LoadStdProfileSettings(4);

	m_langid= GetBuiltInLanguage(); 

	LANGID langid = CLanguageOptions::GetLanguage();
	if (langid != GetBuiltInLanguage())
	{
		CString resourceDllPath = FindResourceDllPathByLangid(langid);
		if (!resourceDllPath.IsEmpty())
		{
			// Load language resource DLL
			HINSTANCE dll = LoadLibrary(resourceDllPath);
			if (dll != NULL)
			{
				// Set default module handle for loading of resources
				AfxSetResourceHandle(dll);
				m_langid = langid;
			}
			else
			{
				TRACE(_T("LoadLibrary(%s) failed: %u\r\n"), resourceDllPath, GetLastError());
			}
		}
		// else: We use our built-in English resources.

		CLanguageOptions::SetLanguage(m_langid);
	}

	GetOptions()->LoadFromRegistry();

	free((void*)m_pszHelpFilePath);
	m_pszHelpFilePath=_tcsdup(ConstructHelpFileName()); // ~CWinApp() will free this memory.

	m_pDocTemplate = new CSingleDocTemplate(
		IDR_MAINFRAME,
		RUNTIME_CLASS(CDirstatDoc),
		RUNTIME_CLASS(CMainFrame),
		RUNTIME_CLASS(CGraphView));
	if (!m_pDocTemplate)
		return FALSE;
	AddDocTemplate(m_pDocTemplate);
	
	CCommandLineInfo cmdInfo;
	ParseCommandLine(cmdInfo);

	m_nCmdShow= SW_HIDE;
	if (!ProcessShellCommand(cmdInfo))
		return FALSE;

	GetMainFrame()->InitialShowWindow();
	m_pMainWnd->UpdateWindow();

	// When called by setup.exe, windirstat remained in the
	// background, so we do a
	m_pMainWnd->BringWindowToTop();
	m_pMainWnd->SetForegroundWindow();

	if (cmdInfo.m_nShellCommand != CCommandLineInfo::FileOpen)
	{
		OnFileOpen();
	}

	return TRUE;
}
开发者ID:coapp-packages,项目名称:windirstat,代码行数:76,代码来源:windirstat.cpp

示例6: Scintilla_RegisterClasses


//.........这里部分代码省略.........
		OH_MessageBox(t, "OpenHoldem keyboard.dll ERROR", MB_OK | MB_TOPMOST);
		return false;
	}
	else
	{
		_dll_keyboard_process_message = (keyboard_process_message_t) GetProcAddress(_keyboard_dll, "ProcessMessage");
		_dll_keyboard_sendstring = (keyboard_sendstring_t) GetProcAddress(_keyboard_dll, "SendString");
		_dll_keyboard_sendkey = (keyboard_sendkey_t) GetProcAddress(_keyboard_dll, "SendKey");

		if (_dll_keyboard_process_message==NULL || _dll_keyboard_sendstring==NULL || _dll_keyboard_sendkey==NULL)
		{
			CString		t = "";
			t.Format("Unable to find all symbols in keyboard.dll");
			OH_MessageBox(t, "OpenHoldem keyboard.dll ERROR", MB_OK | MB_TOPMOST);

			FreeLibrary(_keyboard_dll);
			_keyboard_dll = NULL;
			return false;
		}
	}

	MyLoadStdProfileSettings(k_number_of_last_recently_used_files_in_file_menu);
	// Register the application's document templates.  Document templates
	//  serve as the connection between documents, frame windows and views
	CSingleDocTemplate* pDocTemplate;

	pDocTemplate = new CSingleDocTemplate(
		IDR_MAINFRAME,
		RUNTIME_CLASS(COpenHoldemDoc),
		RUNTIME_CLASS(CMainFrame),	   // main SDI frame window
		RUNTIME_CLASS(COpenHoldemView));
	if (!pDocTemplate)
		return FALSE;
	AddDocTemplate(pDocTemplate);

	EnableShellOpen();
	RegisterShellFileTypes(false);

	// Parse command line for standard shell commands, DDE, file open
	CCommandLineInfo cmdInfo;
	ParseCommandLine(cmdInfo);

	// Open the most recently saved file. (First on the MRU list.) Get the last
	// file from the registry. We need not account for cmdInfo.m_bRunAutomated and
	// cmdInfo.m_bRunEmbedded as they are processed before we get here.
	if (cmdInfo.m_nShellCommand == CCommandLineInfo::FileNew)
	{
		CString sLastPath(GetProfileString(_afxFileSection, "File1"));

		if (! sLastPath.IsEmpty())
		{
			CFile f;

			// If file is there, set to open!
			if (f.Open(sLastPath, CFile::modeRead | CFile::shareDenyWrite))
			{
				cmdInfo.m_nShellCommand = CCommandLineInfo::FileOpen;
				cmdInfo.m_strFileName = sLastPath;
				f.Close();
			}
		}
	}

	// Dispatch commands specified on the command line.  Will return FALSE if
	// app was launched with /RegServer, /Register, /Unregserver or /Unregister.
	if (!ProcessShellCommand(cmdInfo))
开发者ID:ohzooboy,项目名称:oh,代码行数:67,代码来源:OpenHoldem.cpp

示例7: AfxEnableControlContainer

BOOL CVoiceMApp::InitInstance() {

	AfxEnableControlContainer();

	// Standard initialization
	// If you are not using these features and wish to reduce the size
	//  of your final executable, you should remove from the following
	//  the specific initialization routines you do not need.

#ifdef _AFXDLL
	Enable3dControls();			// Call this when using MFC in a shared DLL
#else
	Enable3dControlsStatic();	// Call this when linking to MFC statically
#endif

	SetRegistryKey(_T("CallFilterComputer"));

	LoadStdProfileSettings(16);  // Load standard INI file options (including MRU)

	// Register the application's document templates.  Document templates
	//  serve as the connection between documents, frame windows and views.

	//----------------------------------
	// PICKS UP REGISTRY CONFIGURATION!!!
	//----------------------------------
	char DefMsgPath[120];
	::GetCurrentDirectory(120, DefMsgPath);

	m_MsgPath			= GetProfileString("Settings", "MsgPath", DefMsgPath);
	m_GreetStop			= GetProfileString("Settings", "GreetStop", "Stop.wav");
	m_GreetFName		= GetProfileString("Settings", "GreetName", "Greeting.wav");
	m_GreetFNameB		= GetProfileString("Settings", "GreetNameBlocked", "GreetingBlocked.wav");
	m_Rings				= GetProfileInt("Settings", "Rings", 6);
	m_Seconds			= GetProfileInt("Settings", "Seconds", 30);
	m_SecondsBlocked    = GetProfileInt("Settings", "SecondsBlocked", 10);
	//-------------------------------------------------------------
	
	CSingleDocTemplate* pDocTemplate;
	pDocTemplate = new CSingleDocTemplate(
		IDR_MAINFRAME,
		RUNTIME_CLASS(CVoiceMDoc),
		RUNTIME_CLASS(CMainFrame),       // main SDI frame window
		RUNTIME_CLASS(CVoiceMView));
	AddDocTemplate(pDocTemplate);

	// Parse command line for standard shell commands, DDE, file open
	CCommandLineInfo cmdInfo;
	ParseCommandLine(cmdInfo);

	// Dispatch commands specified on the command line
	if (!ProcessShellCommand(cmdInfo))
		return FALSE;

	// The one and only window has been initialized, so show and update it.
/*apaga*/	m_pMainWnd->ShowWindow(SW_SHOW);
	m_pMainWnd->UpdateWindow();


#ifdef _DEBUG   //LOG CALLFILTER
	time_t ltime;
	time( &ltime );
	LogFile << "CallFilter started at: " << ctime( &ltime ) << endl;
#endif

	//--------------------------------------------------	
	// Init TAPI, 
	//--------------------------------------------------
    if( TFAILED(::TfxLineInitialize()) ) 
	{
        ::AfxMessageBox("Init TAPI failed!");
        return FALSE;
	}

	//--------------------------------------------------	
	// Create CtLine and CtWave objects
	//--------------------------------------------------
	m_pLine    = new CtLine();
	m_pWave    = new CtWave(this);     // sink in this object

	if (m_pLine == NULL || m_pWave == NULL) 
	{
		AfxMessageBox("Create line or wave object failed!");
		return FALSE;
	}

	//-----------------------------------------------------
	// Open a line with automated voice call capability
	//-----------------------------------------------------
	CtLineDevCaps   ldc;
	CtDeviceID      did;
    TRESULT         tr0, tr1, tr2;
	
	AutoLineID = -1;   
	for(DWORD nLineID = 0; nLineID < ::TfxGetNumLines(); nLineID++ ) {

		//---------------------------
		// Get line's capacity
		//---------------------------
		if( TSUCCEEDED(ldc.GetDevCaps(nLineID)) &&
                (ldc.GetBearerModes() & LINEBEARERMODE_VOICE) &&
//.........这里部分代码省略.........
开发者ID:dysproseum,项目名称:callfilter,代码行数:101,代码来源:VoiceM.cpp

示例8: CSingleDocTemplate

BOOL CClipCxSrvApp::InitInstance()
{

	{	// BLOCK: doc template registration
		// Register the document template.  Document templates serve
		// as the connection between documents, frame windows and views.
		// Attach this form to another document or frame window by changing
		// the document or frame class in the constructor below.
		CSingleDocTemplate* pNewDocTemplate = new CSingleDocTemplate(
			IDR_FCLIPCXSRVETATCXVIEW_TMPL,
			RUNTIME_CLASS(CClipCxSrvDoc),		// document class
			RUNTIME_CLASS(CMainFrame),		// frame class
			RUNTIME_CLASS(FClipCxSrvEtatCxView));		// view class
		AddDocTemplate(pNewDocTemplate);
	}

	if (!AfxSocketInit())
	{
		AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
		return FALSE;
	}

	// Standard initialization
	// If you are not using these features and wish to reduce the size
	//  of your final executable, you should remove from the following
	//  the specific initialization routines you do not need.

#ifdef _AFXDLL
	Enable3dControls();			// Call this when using MFC in a shared DLL
#else
	Enable3dControlsStatic();	// Call this when linking to MFC statically
#endif

	// Change the registry key under which our settings are stored.
	// TODO: You should modify this string to be something appropriate
	// such as the name of your company or organization.
	SetRegistryKey(_T("Local AppWizard-Generated Applications"));

	LoadStdProfileSettings();  // Load standard INI file options (including MRU)

	// Enable DDE Execute open
	EnableShellOpen();
	RegisterShellFileTypes(TRUE);

	// Parse command line for standard shell commands, DDE, file open
	CCommandLineInfo cmdInfo;
	ParseCommandLine(cmdInfo);

	// Dispatch commands specified on the command line
	if (!ProcessShellCommand(cmdInfo))
		return FALSE;
///////////////////////////////////////////////////////////
	
	//NOTIFYICONDATA  m_tnd;

	m_tnd.cbSize		= sizeof(NOTIFYICONDATA);
	m_tnd.hWnd		= m_pMainWnd->m_hWnd;
	m_tnd.uID			= IDR_MAINFRAME;
	m_tnd.uFlags		= NIF_MESSAGE|NIF_ICON;
	m_tnd.uCallbackMessage	= MYWM_NOTIFYICON;
	VERIFY( m_tnd.hIcon = ::LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE (IDR_MAINFRAME)) );
	m_tnd.uFlags		= NIF_MESSAGE|NIF_ICON|NIF_TIP;
	strcpy(m_tnd.szTip, "ClipCxSrv running" );
	Shell_NotifyIcon(NIM_ADD, &m_tnd);


	// The one and only window has been initialized, so show and update it.
	m_pMainWnd->ShowWindow(SW_HIDE);

	
	// Enable drag/drop open
	m_pMainWnd->DragAcceptFiles();
	m_pMainWnd->SetClipboardViewer();//rajoute l'applis dans la chaine du clipboard
	::ShellExecute(m_pMainWnd->m_hWnd,"open","regsvr32.exe","/s clipcxshell.dll",NULL,SW_SHOWNORMAL);
	
//	m_pMainWnd->ShowWindow(SW_MINIMIZE);
//	m_pMainWnd->ShowWindow(SW_HIDE);

	return TRUE;
}
开发者ID:Jcb888,项目名称:ClpCxSrv,代码行数:80,代码来源:ClipCxSrv.cpp

示例9: RegCloseKey

BOOL CAnMapApp::InitInstance()
{
	// Standard initialization

//#ifdef _AFXDLL
//	Enable3dControls();			// Call this when using MFC in a shared DLL
//#else
//	Enable3dControlsStatic();	// Call this when linking to MFC statically
//#endif

	// Change the registry key under which our settings are stored.
	HKEY key;
	DWORD dwDisp;
	DWORD Size = 256;
	if( RegCreateKeyEx( HKEY_LOCAL_MACHINE, "Software\\SiemenTech\\Helbreath", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ, NULL, &key, &dwDisp ) != ERROR_SUCCESS ) return FALSE;

	if( RegQueryValueEx(key, "RootPath", 0, NULL, (LPBYTE)m_strWorkingFolder, &Size) != ERROR_SUCCESS )
	{
		RegCloseKey(key);
		return FALSE;
	}
	if( memcmp( m_strWorkingFolder, "", 1 ) == 0 ) return FALSE;

	if (OpenMutex(MUTEX_ALL_ACCESS, FALSE, "AnMap") != NULL) return FALSE;

	SetRegistryKey(_T("Local AppWizard-Generated Applications"));
	m_strLastFile = GetProfileString( "Settings", "LastFile" );
	HANDLE hFile = CreateFile( m_strLastFile, GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL);
	if( hFile == INVALID_HANDLE_VALUE ) m_strLastFile = "";
	else CloseHandle( hFile );
	m_bAutoSave = GetProfileInt( "Settings", "AutoSave", 1 );
	if( m_bAutoSave == 0 ) m_bAutoSave = FALSE;
	else m_bAutoSave = TRUE;

	m_dwAutoSaveDelay = GetProfileInt( "Settings", "AutoSaveDelay", 10 );//레지스트리에 저장된 값은 Minute, 안에서 쓰는 값은 MiliSecond로 바꾼다.
	if( m_dwAutoSaveDelay < 1 ) m_dwAutoSaveDelay = 1;
	if( m_dwAutoSaveDelay > 60 ) m_dwAutoSaveDelay = 60;

	m_dwCursorDelay = GetProfileInt( "Settings", "Cursor", 150 );
	if( m_dwCursorDelay > 1000 ) m_dwCursorDelay = 1000;

	m_dwScrollDelay = GetProfileInt( "Settings", "ScrollDelay", 20 );
	if( m_dwScrollDelay < 5 ) m_dwScrollDelay = 5;
	if( m_dwScrollDelay > 100 ) m_dwScrollDelay = 100;

	// Register document templates

	CSplash splash;
	//splash.Create(NULL);
	splash.ShowWindow(SW_SHOW);
	splash.UpdateWindow();

	CSingleDocTemplate* pDocTemplate;
	pDocTemplate = new CSingleDocTemplate(
		IDR_MAINFRAME,
		RUNTIME_CLASS(CAnMapDoc),
		RUNTIME_CLASS(CMainFrame),       // main SDI frame window
		RUNTIME_CLASS(CAnMapView));
	AddDocTemplate(pDocTemplate);

	// Parse command line for standard shell commands, DDE, file open
	CCommandLineInfo cmdInfo;
	ParseCommandLine(cmdInfo);
	if( cmdInfo.m_nShellCommand == CCommandLineInfo::FileOpen ) m_strLastFile = cmdInfo.m_strFileName;
	if (!ProcessShellCommand(cmdInfo)) return FALSE;
	//m_pMainWnd->DragAcceptFiles();
	splash.DestroyWindow();

	m_pMainWnd->ShowWindow(SW_SHOWMAXIMIZED);
	m_pMainWnd->UpdateWindow();
	return TRUE;
}
开发者ID:pawelsawicz,项目名称:Helbreath-Mysql-2016,代码行数:72,代码来源:AnMap.cpp

示例10: sizeof

BOOL CResViewerApp::InitInstance()
{
    // InitCommonControlsEx() is required on Windows XP if an application
    // manifest specifies use of ComCtl32.dll version 6 or later to enable
    // visual styles.  Otherwise, any window creation will fail.
    INITCOMMONCONTROLSEX InitCtrls;
    InitCtrls.dwSize = sizeof(InitCtrls);
    // Set this to include all the common control classes you want to use
    // in your application.
    InitCtrls.dwICC = ICC_WIN95_CLASSES;
    InitCommonControlsEx(&InitCtrls);

    CWinApp::InitInstance();

    // Initialize OLE libraries
    if (!AfxOleInit())
    {
        AfxMessageBox(IDP_OLE_INIT_FAILED);
        return FALSE;
    }
    AfxEnableControlContainer();
    // Standard initialization
    // If you are not using these features and wish to reduce the size
    // of your final executable, you should remove from the following
    // the specific initialization routines you do not need
    // Change the registry key under which our settings are stored
    // TODO: You should modify this string to be something appropriate
    // such as the name of your company or organization
    SetRegistryKey(_T("Local AppWizard-Generated Applications"));
    LoadStdProfileSettings(8);  // Load standard INI file options (including MRU)
    // Register the application's document templates.  Document templates
    //  serve as the connection between documents, frame windows and views
    CSingleDocTemplate* pDocTemplate;
    pDocTemplate = new CSingleDocTemplate(
        IDR_MAINFRAME,
        RUNTIME_CLASS(CResViewerDoc),
        RUNTIME_CLASS(CMainFrame),       // main SDI frame window
        RUNTIME_CLASS(CResListView));
    if (!pDocTemplate)
        return FALSE;
    AddDocTemplate(pDocTemplate);


    // Enable DDE Execute open
    EnableShellOpen();
    RegisterShellFileTypes(TRUE);

    // Parse command line for standard shell commands, DDE, file open
    CCommandLineInfo cmdInfo;
    ParseCommandLine(cmdInfo);


    // Dispatch commands specified on the command line.  Will return FALSE if
    // app was launched with /RegServer, /Register, /Unregserver or /Unregister.
    if (!ProcessShellCommand(cmdInfo))
        return FALSE;

    // The one and only window has been initialized, so show and update it
    m_pMainWnd->ShowWindow(SW_SHOW);
    m_pMainWnd->UpdateWindow();
    // call DragAcceptFiles only if there's a suffix
    //  In an SDI app, this should occur after ProcessShellCommand
    // Enable drag/drop open
    m_pMainWnd->DragAcceptFiles();
    return TRUE;
}
开发者ID:fatrar,项目名称:yiqiulib,代码行数:66,代码来源:ResViewer.cpp

示例11: ParseCommandLine

BOOL CMyFiveApp::InitInstance()
{
	// CG: The following block was added by the Splash Screen component.
\
	{
\
		CCommandLineInfo cmdInfo;
\
		ParseCommandLine(cmdInfo);
\

\
		CSplashWnd::EnableSplashScreen(cmdInfo.m_bShowSplash);
\
	}
	AfxEnableControlContainer();
	
	//¼ÓÔØÌ×½Ó×Ö¿â
	WORD wVersionRequested;
	WSADATA wsaData;
	int err;
	wVersionRequested = MAKEWORD(2,2);
	err = WSAStartup(wVersionRequested,&wsaData);
	if(err != 0)
		return FALSE;
	if(LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 2)
	{
		WSACleanup();
		return FALSE;
	} 


	// Standard initialization
	// If you are not using these features and wish to reduce the size
	//  of your final executable, you should remove from the following
	//  the specific initialization routines you do not need.

#ifdef _AFXDLL
	Enable3dControls();			// Call this when using MFC in a shared DLL
#else
	Enable3dControlsStatic();	// Call this when linking to MFC statically
#endif

	// Change the registry key under which our settings are stored.
	// TODO: You should modify this string to be something appropriate
	// such as the name of your company or organization.
	SetRegistryKey(_T("Local AppWizard-Generated Applications"));

	LoadStdProfileSettings();  // Load standard INI file options (including MRU)

	// Register the application's document templates.  Document templates
	//  serve as the connection between documents, frame windows and views.

	CSingleDocTemplate* pDocTemplate;
	pDocTemplate = new CSingleDocTemplate(
		IDR_MAINFRAME,
		RUNTIME_CLASS(CMyFiveDoc),
		RUNTIME_CLASS(CMainFrame),       // main SDI frame window
		RUNTIME_CLASS(CMyFiveView));
	AddDocTemplate(pDocTemplate);

	// Parse command line for standard shell commands, DDE, file open
	CCommandLineInfo cmdInfo;
	ParseCommandLine(cmdInfo);

	// Dispatch commands specified on the command line
	if (!ProcessShellCommand(cmdInfo))
		return FALSE;

	// The one and only window has been initialized, so show and update it.
	m_pMainWnd->ShowWindow(SW_SHOW);
	m_pMainWnd->UpdateWindow();

	return TRUE;
}
开发者ID:Botrix,项目名称:gobang-1,代码行数:75,代码来源:MyFive.cpp

示例12: Enable3dControls

BOOL CExsylorApp::InitInstance()
{
	// Standard initialization
	// If you are not using these features and wish to reduce the size
	//  of your final executable, you should remove from the following
	//  the specific initialization routines you do not need.

#ifdef _AFXDLL
	Enable3dControls();			// Call this when using MFC in a shared DLL
#else
	Enable3dControlsStatic();	// Call this when linking to MFC statically
#endif

	// Change the registry key under which our settings are stored.
	// TODO: You should modify this string to be something appropriate
	// such as the name of your company or organization.
	SetRegistryKey(_T("Local AppWizard-Generated Applications"));

	LoadStdProfileSettings(8);  // Load standard INI file options (including MRU)

	// Register the application's document templates.  Document templates
	//  serve as the connection between documents, frame windows and views.
//945  m_System = TRUE;

    pScriptDocTemplate = new CMultiDocTemplate(
        IDR_SCRIPTTYPE,
        RUNTIME_CLASS(CScriptDoc),
        RUNTIME_CLASS(CSplitModFrame),        // standard MDI child frame
        RUNTIME_CLASS(CModView));
    AddDocTemplate(pScriptDocTemplate);

    pRegulTemplate = new CMultiDocTemplate(
        IDR_REG_SCRIPT,
        RUNTIME_CLASS(CScriptDoc),
        RUNTIME_CLASS(CSplitKBFrame),        // standard MDI child frame
        RUNTIME_CLASS(CWordRegView));
    AddDocTemplate(pRegulTemplate);

    pWordScriptTemplate = new CMultiDocTemplate(
        IDR_WORD_SCRIPT,
        RUNTIME_CLASS(CScriptDoc),
        RUNTIME_CLASS(CSplitDBFrame),        // standard MDI child frame
        RUNTIME_CLASS(CWordView));
    AddDocTemplate(pWordScriptTemplate);

    pWordEditTemplate = new CMultiDocTemplate(
        IDR_WORD_EDIT,
        RUNTIME_CLASS(CScriptDoc),
        RUNTIME_CLASS(CSplitDBEditFrame),        // standard MDI child frame
        RUNTIME_CLASS(CWordView));
    AddDocTemplate(pWordEditTemplate);

    pRegulEditTemplate = new CMultiDocTemplate(
        IDR_REG_EDIT,
        RUNTIME_CLASS(CScriptDoc),
        RUNTIME_CLASS(CSplitKBEditFrame),        // standard MDI child frame
        RUNTIME_CLASS(CWordRegView));
    AddDocTemplate(pRegulEditTemplate);

    pObjectTemplate = new CMultiDocTemplate(
        IDR_EXSTYPE,
        RUNTIME_CLASS(CScriptDoc),
        RUNTIME_CLASS(CSplitRecognFrame),    // standard MDI child frame
        RUNTIME_CLASS(CRecogScriptView));
    AddDocTemplate(pObjectTemplate);

    pAimTemplate = new CMultiDocTemplate(
        IDR_EXSTYPE,
        RUNTIME_CLASS(CScriptDoc),
        RUNTIME_CLASS(CSplitRecognFrame),    // standard MDI child frame
        RUNTIME_CLASS(CRecogScriptView));
    AddDocTemplate(pAimTemplate);

    pExsDocTemplate = new CMultiDocTemplate(
        IDR_EXSTYPE,
        RUNTIME_CLASS(CScriptDoc),
        RUNTIME_CLASS(CSplitRecognFrame),    // standard MDI child frame
        RUNTIME_CLASS(CRecogScriptView));
    AddDocTemplate(pExsDocTemplate);
    
    pViewBMTemplate = new CMultiDocTemplate(
        IDR_EMPTY,
        RUNTIME_CLASS(CScriptDoc),
        RUNTIME_CLASS(CSplitViewBMFrame),    // standard MDI child frame
        RUNTIME_CLASS(CBM_View));
    AddDocTemplate(pViewBMTemplate);
    
    pViewExplanTemplate = new CMultiDocTemplate(
        IDR_EXPLAN,
        RUNTIME_CLASS(CScriptDoc),
        RUNTIME_CLASS(CSplitExplanFrame),    // standard MDI child frame
        RUNTIME_CLASS(CExplanStepView));
    AddDocTemplate(pViewExplanTemplate);
    
    pViewIndTemplate = new CMultiDocTemplate(
        IDR_SCRIPTTYPE,
        RUNTIME_CLASS(CScriptDoc),
        RUNTIME_CLASS(CIndWnd),    // standard MDI child frame
        RUNTIME_CLASS(CFormInd));
    AddDocTemplate(pViewIndTemplate);
//.........这里部分代码省略.........
开发者ID:Stas777,项目名称:Exsylor,代码行数:101,代码来源:Exsylor.cpp

示例13: AfxEnableControlContainer

BOOL CProtoHapticApp::InitInstance()
{
	AfxEnableControlContainer();

	// Standard initialization
	// If you are not using these features and wish to reduce the size
	//  of your final executable, you should remove from the following
	//  the specific initialization routines you do not need.

#ifdef _AFXDLL
	Enable3dControls();			// Call this when using MFC in a shared DLL
#else
	Enable3dControlsStatic();	// Call this when linking to MFC statically
#endif

	// Change the registry key under which our settings are stored.
	// TODO: You should modify this string to be something appropriate
	// such as the name of your company or organization.
	SetRegistryKey(_T("Local AppWizard-Generated Applications"));

	LoadStdProfileSettings();  // Load standard INI file options (including MRU)

	// Register the application's document templates.  Document templates
	//  serve as the connection between documents, frame windows and views.

	CSingleDocTemplate* pDocTemplate;
	pDocTemplate = new CSingleDocTemplate(
		IDR_MAINFRAME,
		RUNTIME_CLASS(CProtoHapticDoc),
		RUNTIME_CLASS(CMainFrame),       // main SDI frame window
		RUNTIME_CLASS(CProtoHapticView));
	AddDocTemplate(pDocTemplate);


	// Parse command line for standard shell commands, DDE, file open
	CCommandLineInfo cmdInfo;
	ParseCommandLine(cmdInfo);

	// Dispatch commands specified on the command line
	if (!ProcessShellCommand(cmdInfo))
		return FALSE;

	CView* pActiveView = ((CFrameWnd*) m_pMainWnd)->GetActiveView();
	m_graphicalView = pActiveView;
	m_codeView = (CView*) new CCodeView();

	CDocument* pCurrentDoc = ((CFrameWnd*)m_pMainWnd)->GetActiveDocument();

	// Initialize a CCreateContext to point to the active document.
	// With this context, the new view is added to the document
	// when the view is created in CView::OnCreate().
	CCreateContext newContext;
	newContext.m_pNewViewClass = NULL;
	newContext.m_pNewDocTemplate = NULL;
	newContext.m_pLastView = NULL;
	newContext.m_pCurrentFrame = NULL;
	newContext.m_pCurrentDoc = pCurrentDoc;

	// The ID of the initial active view is AFX_IDW_PANE_FIRST.
	// Incrementing this value by one for additional views works
	// in the standard document/view case but the technique cannot
	// be extended for the CSplitterWnd case.
	UINT viewID = AFX_IDW_PANE_FIRST + 1;
	CRect rect(0, 0, 0, 0); // Gets resized later.

	// Create the new view. In this example, the view persists for
	// the life of the application. The application automatically
	// deletes the view when the application is closed.
	m_codeView->Create(NULL, "", WS_CHILD, rect, m_pMainWnd, viewID, &newContext);

	// When a document template creates a view, the WM_INITIALUPDATE
	// message is sent automatically. However, this code must
	// explicitly send the message, as follows.
	m_codeView->SendMessage(WM_INITIALUPDATE, 0, 0);

	((CProtoHapticView*)m_graphicalView)->SetCodeView(m_codeView);

	// The one and only window has been initialized, so show and update it.
	m_pMainWnd->ShowWindow(SW_SHOW);
	m_pMainWnd->UpdateWindow();

	CMenu* pMenu = AfxGetApp()->GetMainWnd()->GetMenu();
	pMenu->CheckMenuItem( ID_VIEW_EDITMODE, MF_CHECKED );
	pMenu->CheckMenuItem( ID_VIEW_VIEWMODE, MF_UNCHECKED );

	m_editPointSize= 0.1f;
	m_editPointSnapDist= 0.3f;
	m_rotationGuess= 0.5;

	m_planViewport= false;
	m_elevationViewport= false;
	m_frontElevation= false;
	m_primaryDevice= "Default PHANToM";
	m_secondaryDevice= "Not Configured";
	m_useDefault= true;
	m_passive= true;
	m_twoDevices= false;

	m_audioTouch= false;
	m_audioSnapTo= false;
//.........这里部分代码省略.........
开发者ID:neilforrest,项目名称:protohaptic,代码行数:101,代码来源:ProtoHaptic.cpp

示例14: _CrtDumpMemoryLeaks

//////////////////////////////////////////////////////////////////////////////
// CDemoApp initialization
BOOL CDemoApp::InitInstance()
{
	// <dave> dump memory leaks
#ifdef _DEBUG
	_CrtDumpMemoryLeaks();
	_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
#endif

#if _MSC_VER <= 1200
	// Standard initialization
#ifdef _AFXDLL
	Enable3dControls();			// Call this when using MFC in a shared DLL
#else
	Enable3dControlsStatic();	// Call this when linking to MFC statically
#endif
#endif

	LoadStdProfileSettings(9);  // Load standard INI file options (including MRU)

	// Register the application's document templates.  Document templates
	//  serve as the connection between documents, frame windows and views.
	CMultiDocTemplate* pDocTemplate;
	pDocTemplate = new CMultiDocTemplate(
		IDR_DEMOTYPE,
		RUNTIME_CLASS(CDemoDoc),
		RUNTIME_CLASS(CChildFrame), // custom MDI child frame
		RUNTIME_CLASS(CDemoView));
	demoTemplate = pDocTemplate;
	AddDocTemplate(pDocTemplate);

	// create main MDI Frame window
	CMainFrame* pMainFrame = new CMainFrame;
	if (!pMainFrame->LoadFrame(IDR_MAINFRAME)) return FALSE;
	m_pMainWnd = pMainFrame;

	// This code replaces the MFC created menus with 
	// the Ownerdrawn versions 
	pDocTemplate->m_hMenuShared=pMainFrame->NewMenu();
	pMainFrame->m_hMenuDefault=pMainFrame->NewDefaultMenu();
	// This simulates a window being opened if you don't have
	// a default window displayed at startup
	pMainFrame->OnUpdateFrameMenu(pMainFrame->m_hMenuDefault);

	// Parse command line for standard shell commands, DDE, file open
	CCommandLineInfo cmdInfo;
    // Alter behaviour to not open window immediately
    cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
	ParseCommandLine(cmdInfo);

	// Dispatch commands specified on the command line
	if (!ProcessShellCommand(cmdInfo)) return FALSE;

#ifdef VATI_EXTENSIONS
    // init m_text by a temporary CxImage 
	CxImage *ima = new CxImage;
	ima->InitTextInfo( &m_text );
	delete ima;
    
	//recall last used font data for Text tool
    _stprintf( m_text.lfont.lfFaceName, GetProfileString ( _T("TextTool"), _T("lfFaceName"), _T("Times New Roman")) );
	m_text.lfont.lfCharSet   = (BYTE)GetProfileInt ( _T("TextTool"), _T("lfCharSet"), EASTEUROPE_CHARSET ) ;
    m_text.lfont.lfWeight    = GetProfileInt ( _T("TextTool"), _T("lfWeight"), 0 );
    m_text.lfont.lfItalic    = (BYTE)GetProfileInt ( _T("TextTool"), _T("lfItalic"), 0 ); 
    m_text.lfont.lfUnderline = (BYTE)GetProfileInt ( _T("TextTool"), _T("lfUnderline"), 0 ); 
    m_text.fcolor = GetProfileInt ( _T("TextTool"), _T("fcolor"), RGB( 255,255,160 ));
    m_text.bcolor = GetProfileInt ( _T("TextTool"), _T("bcolor"), RGB(   0, 80,160 ));
    m_text.opaque = (BYTE)GetProfileInt ( _T("TextTool"), _T("opaque"), 1);
    m_text.b_opacity = (float)(GetProfileInt( _T("TextTool"), _T("opacity"), 0 ))/(float)100.;  
    m_text.b_round   = (BYTE)GetProfileInt ( _T("TextTool"), _T("roundradius"), 25 );
    m_text.smooth    = (BYTE)GetProfileInt ( _T("TextTool"), _T("antialias"), 1 );

	m_optJpegQuality = GetProfileInt(_T("Options"),_T("JpegQualityI"),90) + 0.001f * GetProfileInt(_T("Options"),_T("JpegQualityF"),0);
	m_optJpegOptions = GetProfileInt(_T("Options"),_T("JpegOptions"),0);

	m_optRawOptions = GetProfileInt(_T("Options"),_T("RawOptions"),0);

	nDocType = GetProfileInt(_T("General"),_T("DocType"),0);

	BCMenu::SetMenuDrawMode(GetProfileInt(_T("General"),_T("MenuStyle"),1));

	m_FloodColor.rgbBlue = 255;
	m_FloodColor.rgbGreen = 255;
	m_FloodColor.rgbRed = 255;
	m_FloodColor.rgbReserved = 0;
	m_FloodTolerance = 0;
	m_FloodOpacity = 255;
	m_FloodSelect = 0;

	int i;
	for(i=0;i<25;i++) m_Filters.Kernel5x5[i]=1;
	for(i=0;i<9;i++) m_Filters.Kernel3x3[i]=1;
	m_Filters.kSize = 3;
	m_Filters.kBias = 0;
	m_Filters.kDivisor = 9;

	m_Filters.RotateAngle = 12.345f;
	m_Filters.RotateMethod = 1;
	m_Filters.RotateOverflow = 0;
//.........这里部分代码省略.........
开发者ID:Sumxx,项目名称:XUI,代码行数:101,代码来源:demo.cpp

示例15: SetRegistryKey

BOOL CDxtexApp::InitInstance()
{
    // Change the registry key under which our settings are stored.
    SetRegistryKey(_T("Microsoft"));

    LoadStdProfileSettings();  // Load standard INI file options (including MRU)

    // Register the application's document templates.  Document templates
    //  serve as the connection between documents, frame windows and views.

    m_pDocManager = new CDxtexDocManager;
    
    CMultiDocTemplate* pDocTemplate;
    pDocTemplate = new CMultiDocTemplate(
        IDR_DXTXTYPE,
        RUNTIME_CLASS(CDxtexDoc),
        RUNTIME_CLASS(CChildFrame), // custom MDI child frame
        RUNTIME_CLASS(CDxtexView));
    AddDocTemplate(pDocTemplate);

    // Register file types with Explorer
    //RegisterShellFileTypes();
    //EnableShellOpen();

    // create main MDI Frame window
    CMainFrame* pMainFrame = new CMainFrame;
    if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
        return FALSE;
    m_pMainWnd = pMainFrame;

    // Initialize DirectDraw
    m_pd3d = Direct3DCreate9(D3D_SDK_VERSION);
    if (m_pd3d == NULL)
    {
        AfxMessageBox(ID_ERROR_D3DCREATEFAILED, MB_OK, 0);
        return FALSE;
    }

    HRESULT hr;
    D3DPRESENT_PARAMETERS presentParams;
    D3DDEVTYPE devType;

    ZeroMemory(&presentParams, sizeof(presentParams));
    presentParams.Windowed = TRUE;
    presentParams.SwapEffect = D3DSWAPEFFECT_COPY;
    presentParams.BackBufferWidth = 8;
    presentParams.BackBufferHeight = 8;
    presentParams.BackBufferFormat = D3DFMT_UNKNOWN;

    devType = D3DDEVTYPE_REF; 

    hr = m_pd3d->CreateDevice(D3DADAPTER_DEFAULT, devType, m_pMainWnd->GetSafeHwnd(), 
        D3DCREATE_SOFTWARE_VERTEXPROCESSING, &presentParams, &m_pd3ddev);
    if (FAILED(hr))
    {
        AfxMessageBox(ID_ERROR_CANTCREATEDEVICE);
        return FALSE;
    }

    D3DCAPS9 Caps;
    m_pd3ddev->GetDeviceCaps(&Caps);
    if (Caps.PrimitiveMiscCaps & D3DPMISCCAPS_NULLREFERENCE)
    {
        AfxMessageBox(ID_ERROR_NULLREF);
    }

    // Parse command line for standard shell commands, DDE, file open
    CDxtexCommandLineInfo cmdInfo;
    ParseCommandLine(cmdInfo);
    // Prevent automatic "New" at startup:
    if (cmdInfo.m_nShellCommand == CCommandLineInfo::FileNew)
        cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;

    // Dispatch commands specified on the command line
    if (!ProcessShellCommand(cmdInfo))
        return FALSE;

    // Enable open by dragging files
    m_pMainWnd->DragAcceptFiles();

    // See if we loaded a document
    POSITION posTemp = GetFirstDocTemplatePosition();
    CDxtexDoc* pdoc = NULL;
    POSITION pos = pDocTemplate->GetFirstDocPosition();
    if (pos != NULL)
        pdoc = (CDxtexDoc*)pDocTemplate->GetNextDoc(pos);

    if (!cmdInfo.m_strFileNameAlpha.IsEmpty())
    {
        if (pdoc != NULL)
        {
            pdoc->LoadAlphaBmp(cmdInfo.m_strFileNameAlpha);
        }
    }
    if (cmdInfo.m_bMipMap)
    {
        if (pdoc != NULL)
        {
            pdoc->GenerateMipMaps();
        }
//.........这里部分代码省略.........
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:101,代码来源:dxtex.cpp


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