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;
}
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;
}
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;
}
//.........这里部分代码省略.........
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))
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( <ime );
LogFile << "CallFilter started at: " << ctime( <ime ) << 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) &&
//.........这里部分代码省略.........
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;
}
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;
}
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;
}
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);
//.........这里部分代码省略.........
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;
//.........这里部分代码省略.........
请发表评论