本文整理汇总了C++中ParseCommandLine函数的典型用法代码示例。如果您正苦于以下问题:C++ ParseCommandLine函数的具体用法?C++ ParseCommandLine怎么用?C++ ParseCommandLine使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ParseCommandLine函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sizeof
BOOL CMechanism_HW01App::InitInstance()
{
// 假如應用程式資訊清單指定使用 ComCtl32.dll 6 (含) 以後版本,
// 來啟動視覺化樣式,在 Windows XP 上,則需要 InitCommonControls()。
// 否則任何視窗的建立都將失敗。
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(InitCtrls);
// 設定要包含所有您想要用於應用程式中的
// 通用控制項類別。
InitCtrls.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);
CWinApp::InitInstance();
// 初始化 OLE 程式庫
if (!AfxOleInit())
{
AfxMessageBox(IDP_OLE_INIT_FAILED);
return FALSE;
}
AfxEnableControlContainer();
EnableTaskbarInteraction(FALSE);
// 需要有 AfxInitRichEdit2() 才能使用 RichEdit 控制項
// AfxInitRichEdit2();
// 標準初始設定
// 如果您不使用這些功能並且想減少
// 最後完成的可執行檔大小,您可以
// 從下列程式碼移除不需要的初始化常式,
// 變更儲存設定值的登錄機碼
// TODO: 您應該適度修改此字串
// (例如,公司名稱或組織名稱)
SetRegistryKey(_T("本機 AppWizard 所產生的應用程式"));
LoadStdProfileSettings(4); // 載入標準 INI 檔選項 (包含 MRU)
// 登錄應用程式的文件範本。文件範本負責在文件、
// 框架視窗與檢視間進行連接
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CMechanism_HW01Doc),
RUNTIME_CLASS(CMainFrame), // 主 SDI 框架視窗
RUNTIME_CLASS(CMechanism_HW01View));
if (!pDocTemplate)
return FALSE;
AddDocTemplate(pDocTemplate);
// 剖析標準 Shell 命令、DDE、檔案開啟舊檔的命令列
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// 在命令列中指定的分派命令。如果已使用
// /RegServer、/Register、/Unregserver 或 /Unregister 啟動應用程式,將傳回 FALSE。
if (!ProcessShellCommand(cmdInfo))
return FALSE;
// 僅初始化一個視窗,所以顯示並更新該視窗
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->SetWindowText("高等機構 - 作業二");
m_pMainWnd->UpdateWindow();
// 只有在 SDI 應用程式中有後置字元時,才呼叫 DragAcceptFiles
// 這會發生於 ProcessShellCommand 之後
return TRUE;
}
示例2: sizeof
BOOL CMServerManagerApp::InitInstance()
{
// 응용 프로그램 매니페스트가 ComCtl32.dll 버전 6 이상을 사용하여 비주얼 스타일을
// 사용하도록 지정하는 경우, Windows XP 상에서 반드시 InitCommonControlsEx()가 필요합니다.
// InitCommonControlsEx()를 사용하지 않으면 창을 만들 수 없습니다.
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(InitCtrls);
// 응용 프로그램에서 사용할 모든 공용 컨트롤 클래스를 포함하도록
// 이 항목을 설정하십시오.
InitCtrls.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);
CWinAppEx::InitInstance();
if (!AfxSocketInit())
{
AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
return FALSE;
}
// OLE 라이브러리를 초기화합니다.
if (!AfxOleInit())
{
AfxMessageBox(IDP_OLE_INIT_FAILED);
return FALSE;
}
AfxEnableControlContainer();
// 표준 초기화
// 이들 기능을 사용하지 않고 최종 실행 파일의 크기를 줄이려면
// 아래에서 필요 없는 특정 초기화
// 루틴을 제거해야 합니다.
// 해당 설정이 저장된 레지스트리 키를 변경하십시오.
// 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);
// 응용 프로그램의 문서 템플릿을 등록합니다. 문서 템플릿은
// 문서, 프레임 창 및 뷰 사이의 연결 역할을 합니다.
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CMServerManagerDoc),
RUNTIME_CLASS(CMainFrame), // 주 SDI 프레임 창입니다.
RUNTIME_CLASS(CMServerManagerView));
if (!pDocTemplate)
return FALSE;
AddDocTemplate(pDocTemplate);
// 표준 셸 명령, DDE, 파일 열기에 대한 명령줄을 구문 분석합니다.
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// 명령줄에 지정된 명령을 디스패치합니다.
// 응용 프로그램이 /RegServer, /Register, /Unregserver 또는 /Unregister로 시작된 경우 FALSE를 반환합니다.
if (!ProcessShellCommand(cmdInfo))
return FALSE;
// 창 하나만 초기화되었으므로 이를 표시하고 업데이트합니다.
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
// 접미사가 있을 경우에만 DragAcceptFiles를 호출합니다.
// SDI 응용 프로그램에서는 ProcessShellCommand 후에 이러한 호출이 발생해야 합니다.
m_pMainWnd->SetWindowText("M-Server Manager");
return TRUE;
}
示例3: Run
int Run(LPTSTR lpstrCmdLine = NULL, int nCmdShow = SW_SHOWDEFAULT)
{
CMessageLoop theLoop;
_Module.AddMessageLoop(&theLoop);
wstring strConfigFile(L"");
wstring strWindowTitle(L"");
vector<wstring> startupTabs;
vector<wstring> startupDirs;
vector<wstring> startupCmds;
int nMultiStartSleep = 0;
wstring strDbgCmdLine(L"");
ParseCommandLine(
lpstrCmdLine,
strConfigFile,
strWindowTitle,
startupTabs,
startupDirs,
startupCmds,
nMultiStartSleep,
strDbgCmdLine);
if (strConfigFile.length() == 0)
{
strConfigFile = wstring(L"console.xml");
// strConfigFile = Helpers::GetModulePath(NULL) + wstring(L"console.xml");
// strConfigFile = wstring(::_wgetenv(L"APPDATA")) + wstring(L"\\Console\\console.xml");
}
if (!g_settingsHandler->LoadSettings(Helpers::ExpandEnvironmentStrings(strConfigFile)))
{
//TODO: error handling
return 1;
}
// create main window
NoTaskbarParent noTaskbarParent;
MainFrame wndMain(strWindowTitle, startupTabs, startupDirs, startupCmds, nMultiStartSleep, strDbgCmdLine);
if (!g_settingsHandler->GetAppearanceSettings().stylesSettings.bTaskbarButton)
{
noTaskbarParent.Create(NULL);
}
if(wndMain.CreateEx(noTaskbarParent.m_hWnd) == NULL)
{
ATLTRACE(_T("Main window creation failed!\n"));
return 1;
}
wndMain.ShowWindow(nCmdShow);
int nRet = theLoop.Run();
if (noTaskbarParent.m_hWnd != NULL) noTaskbarParent.DestroyWindow();
_Module.RemoveMessageLoop();
return nRet;
}
示例4: sizeof
BOOL CLegoApp::InitInstance()
{
// 假如應用程式資訊清單指定使用 ComCtl32.dll 6 (含) 以後版本,
// 來啟動視覺化樣式,在 Windows XP 上,則需要 InitCommonControls()。
// 否則任何視窗的建立都將失敗。
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();
// 需要有 AfxInitRichEdit2() 才能使用 RichEdit 控制項
// AfxInitRichEdit2();
// 標準初始設定
// 如果您不使用這些功能並且想減少
// 最後完成的可執行檔大小,您可以
// 從下列程式碼移除不需要的初始化常式,
// 變更儲存設定值的登錄機碼
// TODO: 您應該適度修改此字串
// (例如,公司名稱或組織名稱)
SetRegistryKey(_T("本機 AppWizard 所產生的應用程式"));
LoadStdProfileSettings(4); // 載入標準 INI 檔選項 (包含 MRU)
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_LegoTYPE,
RUNTIME_CLASS(CLegoDoc),
RUNTIME_CLASS(CChildFrame), // 自訂 MDI 子框架
RUNTIME_CLASS(CLegoView));
if (!pDocTemplate)
return FALSE;
AddDocTemplate(pDocTemplate);
// 建立主 MDI 框架視窗
CMainFrame* pMainFrame = new CMainFrame;
if (!pMainFrame || !pMainFrame->LoadFrame(IDR_MAINFRAME))
{
delete pMainFrame;
return FALSE;
}
m_pMainWnd = pMainFrame;
// 只有在 MDI 應用程式中有後置字元時,才呼叫 DragAcceptFiles
// 這會立即發生在設定 m_pMainWnd 之後
// 剖析標準 Shell 命令、DDE、檔案開啟舊檔的命令列
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// phlin
// DON'T display a new MDI child window during startup!!!
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
// 在命令列中指定的分派命令。如果已使用
// /RegServer、/Register、/Unregserver 或 /Unregister 啟動應用程式,將傳回 FALSE。
if (!ProcessShellCommand(cmdInfo))
return FALSE;
// 已經初始設定主視窗,所以顯示並更新該視窗
pMainFrame->ShowWindow(m_nCmdShow);
pMainFrame->UpdateWindow();
return TRUE;
}
示例5: sizeof
BOOL CRoundAnalyseApp::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);
CWinAppEx::InitInstance();
// Initialize OLE libraries
if (!AfxOleInit())
{
AfxMessageBox(IDP_OLE_INIT_FAILED);
return FALSE;
}
AfxEnableControlContainer();
EnableTaskbarInteraction();
// AfxInitRichEdit2() is required to use RichEdit control
// AfxInitRichEdit2();
// 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(4); // Load standard INI file options (including MRU)
InitContextMenuManager();
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_RoundAnalyseTYPE,
RUNTIME_CLASS(CRoundAnalyseDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CRoundAnalyseView));
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;
// The main window has been initialized, so show and update it
pMainFrame->ShowWindow(m_nCmdShow);
pMainFrame->UpdateWindow();
return TRUE;
}
示例6: sizeof
BOOL CMy601DemoClientApp::InitInstance()
{
// 如果一个运行在 Windows XP 上的应用程序清单指定要
// 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
//则需要 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(FALSE);
// 使用 RichEdit 控件需要 AfxInitRichEdit2()
// AfxInitRichEdit2();
// 标准初始化
// 如果未使用这些功能并希望减小
// 最终可执行文件的大小,则应移除下列
// 不需要的特定初始化例程
// 更改用于存储设置的注册表项
// TODO: 应适当修改该字符串,
// 例如修改为公司或组织名
SetRegistryKey(_T("应用程序向导生成的本地应用程序"));
LoadStdProfileSettings(4); // 加载标准 INI 文件选项(包括 MRU)
InitContextMenuManager();
InitKeyboardManager();
InitTooltipManager();
CMFCToolTipInfo ttParams;
ttParams.m_bVislManagerTheme = TRUE;
theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL,
RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams);
if (!GetConfigFromIni()) // 配置文件中的配置信息不完整时才弹出配置对话框
{
CConnectionSetDlg dlg;
dlg.m_strServerPort = m_strServerPort;
dlg.m_strServerIp = m_strServerIp ;
dlg.m_strLocalPort = m_strLocalServicePort;
dlg.m_strServerDomain = m_strServerDomain;
if (dlg.DoModal()!=IDOK)
return FALSE;
m_bUseIp = dlg.m_iUseIp==0 ? TRUE:FALSE;
if (m_bUseIp)
m_strServerIp = dlg.m_strServerIp;
else
m_strServerDomain = dlg.m_strServerDomain;
m_strServerPort = dlg.m_strServerPort;
m_strLocalServicePort = dlg.m_strLocalPort;
WriteSettingToIni();
}
// 注册应用程序的文档模板。文档模板
// 将用作文档、框架窗口和视图之间的连接
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MENU_MAIN_CLIENT,
RUNTIME_CLASS(CMy601DemoClientDoc),
RUNTIME_CLASS(CMainFrame), // 主 SDI 框架窗口
RUNTIME_CLASS(CMy601DemoClientView));
if (!pDocTemplate)
return FALSE;
AddDocTemplate(pDocTemplate);
// 分析标准 shell 命令、DDE、打开文件操作的命令行
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// 调度在命令行中指定的命令。如果
// 用 /RegServer、/Register、/Unregserver 或 /Unregister 启动应用程序,则返回 FALSE。
if (!ProcessShellCommand(cmdInfo))
return FALSE;
// 唯一的一个窗口已初始化,因此显示它并对其进行更新
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
// 仅当具有后缀时才调用 DragAcceptFiles
//.........这里部分代码省略.........
示例7: AfxGetApp
BOOL CHRSApp::InitInstance()
{
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, youbb should remove from the following
// the specific initialization routines you do not need.
m_BTHand = AfxGetApp()->LoadCursor(IDC_CURSOR_HAND);
#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.
CMultiDocTemplate* pDocTemplate;
pDocTemplate = new CMultiDocTemplate(
IDR_CUSTOMERTYPE,
RUNTIME_CLASS(CCUSTOMERDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CCUSTOMERView));
AddDocTemplate(pDocTemplate);
pDocTemplate = new CMultiDocTemplate(
IDR_BOXTYPE,
RUNTIME_CLASS(CAreaDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CAreaView));
AddDocTemplate(pDocTemplate);
pDocTemplate = new CMultiDocTemplate(
IDR_SALETYPE,
RUNTIME_CLASS(CSaleDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CSaleView));
AddDocTemplate(pDocTemplate);
pDocTemplate = new CMultiDocTemplate(
IDR_ITEMTYPE,
RUNTIME_CLASS(CItemDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CItemView));
AddDocTemplate(pDocTemplate);
pDocTemplate = new CMultiDocTemplate(
IDR_USERTYPE,
RUNTIME_CLASS(CUserDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CUserView));
AddDocTemplate(pDocTemplate);
pDocTemplate = new CMultiDocTemplate(
IDR_COSTTYPE,
RUNTIME_CLASS(CMoneyDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CMoneyView));
AddDocTemplate(pDocTemplate);
// create main MDI Frame window
CMainFrame* pMainFrame = new CMainFrame;
if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
return FALSE;
m_pMainWnd = pMainFrame;
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
ParseCommandLine(cmdInfo);
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
// The main window has been initialized, so show and update it.
m_nCmdShow = SW_MAXIMIZE;
pMainFrame->ShowWindow(m_nCmdShow);
pMainFrame->UpdateWindow();
CDbManger::OpenConnection();
pMainFrame->OnCmdMsg(ID_MENU_LOGIN,0,0,0);
return TRUE;
}
示例8: sizeof
BOOL CMFC_CampusNavigationApp::InitInstance()
{
// 如果一个运行在 Windows XP 上的应用程序清单指定要
// 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
//则需要 InitCommonControlsEx()。 否则,将无法创建窗口。
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(InitCtrls);
// 将它设置为包括所有要在应用程序中使用的
// 公共控件类。
InitCtrls.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);
CWinApp::InitInstance();
// 初始化 OLE 库
if (!AfxOleInit())
{
AfxMessageBox(IDP_OLE_INIT_FAILED);
return FALSE;
}
AfxEnableControlContainer();
EnableTaskbarInteraction(FALSE);
// 使用 RichEdit 控件需要 AfxInitRichEdit2()
// AfxInitRichEdit2();
// 标准初始化
// 如果未使用这些功能并希望减小
// 最终可执行文件的大小,则应移除下列
// 不需要的特定初始化例程
// 更改用于存储设置的注册表项
// TODO: 应适当修改该字符串,
// 例如修改为公司或组织名
SetRegistryKey(_T("应用程序向导生成的本地应用程序"));
LoadStdProfileSettings(4); // 加载标准 INI 文件选项(包括 MRU)
// 注册应用程序的文档模板。 文档模板
// 将用作文档、框架窗口和视图之间的连接
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CMFC_CampusNavigationDoc),
RUNTIME_CLASS(CMainFrame), // 主 SDI 框架窗口
RUNTIME_CLASS(CMFC_CampusNavigationView));
if (!pDocTemplate)
return FALSE;
AddDocTemplate(pDocTemplate);
// 分析标准 shell 命令、DDE、打开文件操作的命令行
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// 调度在命令行中指定的命令。 如果
// 用 /RegServer、/Register、/Unregserver 或 /Unregister 启动应用程序,则返回 FALSE。
if (!ProcessShellCommand(cmdInfo))
return FALSE;
// 唯一的一个窗口已初始化,因此显示它并对其进行更新
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
return TRUE;
}
示例9: memset
//.........这里部分代码省略.........
MessageBox(NULL, "No modules currently available. Contact [email protected] for assistance.", "Fatal Error", MB_OK);
m_pMainWnd->PostMessage(WM_CLOSE);
}
else if (first_launch) {
/*first launch, register all files ext*/
u32 i;
for (i=0; i<gf_modules_get_count(m_user.modules); i++) {
GF_InputService *ifce = (GF_InputService *) gf_modules_load_interface(m_user.modules, i, GF_NET_CLIENT_INTERFACE);
if (!ifce) continue;
if (ifce) {
ifce->CanHandleURL(ifce, "test.test");
gf_modules_close_interface((GF_BaseInterface *)ifce);
}
}
/*set some shortcuts*/
gf_cfg_set_key(m_user.config, "Shortcuts", "VolumeUp", "ctrl+Up");
gf_cfg_set_key(m_user.config, "Shortcuts", "VolumeDown", "ctrl+Down");
gf_cfg_set_key(m_user.config, "Shortcuts", "FastRewind", "ctrl+Left");
gf_cfg_set_key(m_user.config, "Shortcuts", "FastForward", "ctrl+Right");
gf_cfg_set_key(m_user.config, "Shortcuts", "Play", "ctrl+ ");
}
/*check log file*/
const char *str = gf_cfg_get_key(m_user.config, "General", "LogFile");
if (str) {
m_logs = gf_f64_open(str, "wt");
gf_log_set_callback(m_logs, osmo4_do_log);
}
else m_logs = NULL;
/*set log level*/
if (gf_log_set_tools_levels(gf_cfg_get_key(m_user.config, "General", "Logs")) != GF_OK)
fprintf(stdout, "osmo4: invalid log level specified\n");
m_user.opaque = this;
m_user.os_window_handler = pFrame->m_pWndView->m_hWnd;
m_user.EventProc = Osmo4_EventProc;
m_reset = GF_FALSE;
orig_width = 320;
orig_height = 240;
gf_set_progress_callback(this, Osmo4_progress_cbk);
m_term = gf_term_new(&m_user);
if (! m_term) {
MessageBox(NULL, "Cannot load Bevara Access. Contact [email protected] for assistance.", "Fatal Error", MB_OK);
m_pMainWnd->PostMessage(WM_CLOSE);
return TRUE;
}
SetOptions();
UpdateRenderSwitch();
pFrame->SendMessage(WM_SETSIZE, orig_width, orig_height);
//pFrame->m_Address.ReloadURLs();
pFrame->m_Sliders.SetVolume();
m_reconnect_time = 0;
ParseCommandLine(cmdInfo);
start_mode = 0;
if (! cmdInfo.m_strFileName.IsEmpty()) {
pFrame->m_pPlayList->QueueURL(cmdInfo.m_strFileName);
pFrame->m_pPlayList->RefreshList();
pFrame->m_pPlayList->PlayNext();
} else {
char sPL[MAX_PATH];
strcpy((char *) sPL, szUserPath);
strcat(sPL, "gpac_pl.m3u");
pFrame->m_pPlayList->OpenPlayList(sPL);
const char *sOpt = gf_cfg_get_key(GetApp()->m_user.config, "General", "PLEntry");
if (sOpt) {
s32 count = (s32)gf_list_count(pFrame->m_pPlayList->m_entries);
pFrame->m_pPlayList->m_cur_entry = atoi(sOpt);
if (pFrame->m_pPlayList->m_cur_entry>=count)
pFrame->m_pPlayList->m_cur_entry = count-1;
} else {
pFrame->m_pPlayList->m_cur_entry = -1;
}
#if 0
if (pFrame->m_pPlayList->m_cur_entry>=0) {
start_mode = 1;
pFrame->m_pPlayList->Play();
}
#endif
sOpt = gf_cfg_get_key(m_user.config, "General", "StartupFile");
if (sOpt && !strstr(sOpt, "gui") ) gf_term_connect(m_term, sOpt);
sOpt = gf_cfg_get_key(m_user.config, "General", "PlaylistLoop");
m_Loop = (sOpt && !strcmp(sOpt, "yes")) ? GF_TRUE : GF_FALSE;
}
pFrame->SetFocus();
pFrame->SetForegroundWindow();
return TRUE;
}
示例10: sizeof
BOOL Cese599_project2App::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();
EnableTaskbarInteraction(FALSE);
// AfxInitRichEdit2() is required to use RichEdit control
// AfxInitRichEdit2();
// 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(4); // 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(Cese599_project2Doc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(Cese599_project2View));
if (!pDocTemplate)
return FALSE;
AddDocTemplate(pDocTemplate);
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// Enable DDE Execute open
EnableShellOpen();
RegisterShellFileTypes(TRUE);
// 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;
}
示例11: EnumWindows
BOOL CInstallApp::InitInstance()
{
HWND oldHWnd = NULL;
EnumWindows(EnumWndProc,(LPARAM)&oldHWnd); //枚举所有运行的窗口
if(oldHWnd != NULL)
{
::ShowWindow(oldHWnd,SW_SHOWNORMAL); //激活找到的前一个程序
::SetForegroundWindow(oldHWnd); //把它设为前景窗口
return false; //退出本次运行
}
// 如果一个运行在 Windows XP 上的应用程序清单指定要
// 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
//则需要 InitCommonControlsEx()。否则,将无法创建窗口。
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(InitCtrls);
// 将它设置为包括所有要在应用程序中使用的
// 公共控件类。
InitCtrls.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);
CWinApp::InitInstance();
if (!AfxSocketInit())
{
AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
return FALSE;
}
// 初始化 OLE 库
if (!AfxOleInit())
{
AfxMessageBox(IDP_OLE_INIT_FAILED);
return FALSE;
}
AfxEnableControlContainer();
// 标准初始化
// 如果未使用这些功能并希望减小
// 最终可执行文件的大小,则应移除下列
// 不需要的特定初始化例程
// 更改用于存储设置的注册表项
// TODO: 应适当修改该字符串,
// 例如修改为公司或组织名
SetRegistryKey(_T("BCGSoft\\BCGControlBarPro\\Samples"));
// LoadStdProfileSettings(); // 加载标准 INI 文件选项(包括 MRU)
SetRegistryBase (_T("Settings"));
InitContextMenuManager();
InitKeyboardManager();
InitParam();
// 注册应用程序的文档模板。文档模板
// 将用作文档、框架窗口和视图之间的连接
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CInstallDoc),
RUNTIME_CLASS(CMainFrame), // 主 SDI 框架窗口
RUNTIME_CLASS(CInstallView));
if (!pDocTemplate)
return FALSE;
AddDocTemplate(pDocTemplate);
// 分析标准外壳命令、DDE、打开文件操作的命令行
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// 调度在命令行中指定的命令。如果
// 用 /RegServer、/Register、/Unregserver 或 /Unregister 启动应用程序,则返回 FALSE。
if (!ProcessShellCommand(cmdInfo))
return FALSE;
LoadCustomState ();
// 唯一的一个窗口已初始化,因此显示它并对其进行更新
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
// 仅当具有后缀时才调用 DragAcceptFiles
// 在 SDI 应用程序中,这应在 ProcessShellCommand 之后发生
return TRUE;
}
示例12: main
int main(int argc, char** argv) {
NcError error(NcError::verbose_nonfatal);
try {
// Input file
std::string strInputFile;
// Input file list
std::string strInputFileList;
// Input file format
std::string strInputFormat;
// NetCDF file containing latitude and longitude arrays
std::string strLatLonFile;
// Output file (NetCDF)
std::string strOutputFile;
// Output variable name
std::string strOutputVariable;
// Column in which the longitude index appears
int iLonIxCol;
// Column in which the latitude index appears
int iLatIxCol;
// Begin latitude
double dLatBegin;
// End latitude
double dLatEnd;
// Begin longitude
double dLonBegin;
// End longitude
double dLonEnd;
// Number of latitudes in output
int nLat;
// Number of longitudes in output
int nLon;
// Parse the command line
BeginCommandLine()
CommandLineString(strInputFile, "in", "");
CommandLineString(strInputFileList, "inlist", "");
CommandLineStringD(strInputFormat, "in_format", "std", "(std|visit)");
CommandLineString(strOutputFile, "out", "");
CommandLineString(strOutputVariable, "outvar", "density");
CommandLineInt(iLonIxCol, "iloncol", 8);
CommandLineInt(iLatIxCol, "ilatcol", 9);
CommandLineDouble(dLatBegin, "lat_begin", -90.0);
CommandLineDouble(dLatEnd, "lat_end", 90.0);
CommandLineDouble(dLonBegin, "lon_begin", 0.0);
CommandLineDouble(dLonEnd, "lon_end", 360.0);
CommandLineInt(nLat, "nlat", 180);
CommandLineInt(nLon, "nlon", 360);
ParseCommandLine(argc, argv);
EndCommandLine(argv)
AnnounceBanner();
// Check input
if ((strInputFile == "") && (strInputFileList == "")) {
_EXCEPTIONT("No input file (--in) or (--inlist) specified");
}
if ((strInputFile != "") && (strInputFileList != "")) {
_EXCEPTIONT("Only one input file (--in) or (--inlist) allowed");
}
if (strInputFormat != "std") {
_EXCEPTIONT("UNIMPLEMENTED: Only \"--in_format std\" supported");
}
// Check output
if (strOutputFile == "") {
_EXCEPTIONT("No output file (--out) specified");
}
// Check output variable
if (strOutputVariable == "") {
_EXCEPTIONT("No output variable name (--outvar) specified");
}
// Number of latitudes and longitudes
if (nLat == 0) {
_EXCEPTIONT("UNIMPLEMENTED: --nlat must be specified currently");
}
if (nLon == 0) {
_EXCEPTIONT("UNIMPLEMENTED: --nlon must be specified currently");
}
// Input file list
std::vector<std::string> vecInputFiles;
//.........这里部分代码省略.........
示例13: CSingleDocTemplate
BOOL CMy20120619_2App::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_KILLMOMO_TMPL,
RUNTIME_CLASS(CMy20120619_2Doc), // document class
RUNTIME_CLASS(CMainFrame), // frame class
RUNTIME_CLASS(KillMomo)); // view class
AddDocTemplate(pNewDocTemplate);
}
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(CMy20120619_2Doc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CMy20120619_2View));
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;
}
示例14: InitApplication
//.........这里部分代码省略.........
SetRectEmpty (&gr.rServerLast);
SetRectEmpty (&gr.rViewLog);
SetRectEmpty (&gr.rActions);
gr.fPreview = TRUE;
gr.fVert = TRUE;
gr.fActions = FALSE;
gr.tabLast = tabFILESETS;
Server_SetDefaultView_Horz (&gr.diHorz.viewSvr);
Server_SetDefaultView_Vert (&gr.diVert.viewSvr);
Services_SetDefaultView (&gr.viewSvc);
Aggregates_SetDefaultView (&gr.viewAgg);
Filesets_SetDefaultView (&gr.viewSet);
Replicas_SetDefaultView (&gr.viewRep);
Action_SetDefaultView (&gr.viewAct);
Server_Key_SetDefaultView (&gr.viewKey);
gr.diHorz.cSplitter = -100;
gr.diVert.cSplitter = -89;
gr.cbQuotaUnits = cb1KB;
gr.fOpenMonitors = TRUE;
gr.fCloseUnmonitors = TRUE;
gr.fServerLongNames = FALSE;
gr.fDoubleClickOpens = 2;
gr.fWarnBadCreds = TRUE;
gr.ivSvr = ivSTATUS;
gr.ivAgg = ivSTATUS;
gr.ivSet = ivSTATUS;
gr.ivSvc = ivSTATUS;
}
ULONG status;
if (!AfsClass_Initialize (&status))
{
if (status == ADMCLIENTCANTINITAFSLOCATION)
ImmediateErrorDialog (status, IDS_ERROR_CANT_INIT_AFSCLASS_INSTALL);
else
ImmediateErrorDialog (status, IDS_ERROR_CANT_INIT_AFSCLASS_UNKNOWN);
return FALSE;
}
AfsClass_RequestLongServerNames (gr.fServerLongNames);
AfsClass_SpecifyRefreshDomain (AFSCLASS_WANT_VOLUMES);
// Create a notification object for the AFSClass library, so that it can
// let us know when anything changes. The notification handler we'll
// install will take requests from the rest of the SVRMGR package and
// forward notifications around to whichever windows are actually
// interested.
//
CreateNotificationDispatch();
// Create a few variations on WC_DIALOG, so we get appropriate icons on
// our windows.
//
WNDCLASS wc;
GetClassInfo (THIS_HINST, MAKEINTRESOURCE( WC_DIALOG ), &wc);
wc.hInstance = THIS_HINST;
wc.hIcon = TaLocale_LoadIcon (IDI_MAIN);
wc.lpszClassName = TEXT("AFSManagerClass");
wc.style |= CS_GLOBALCLASS;
RegisterClass (&wc);
GetClassInfo (THIS_HINST, MAKEINTRESOURCE( WC_DIALOG ), &wc);
wc.hInstance = THIS_HINST;
wc.hIcon = TaLocale_LoadIcon (IDI_SERVER);
wc.lpszClassName = TEXT("ServerWindowClass");
wc.style |= CS_GLOBALCLASS;
RegisterClass (&wc);
// Okay, the big step: create the main window (ie, the servers list).
// Note that it doesn't get shown yet!
//
CMDLINEOP op = ParseCommandLine (pszCmdLine);
if (op == opCLOSEAPP)
return FALSE;
if (op == opLOOKUPERRORCODE)
{
Help_FindError();
return FALSE;
}
g.hMain = ModelessDialog (IDD_MAIN, NULL, (DLGPROC)Main_DialogProc);
if (g.hMain == NULL)
return FALSE;
if (op != opNOCELLDIALOG)
{
if (OpenCellDialog() != IDOK)
return FALSE;
}
return TRUE;
}
示例15: main
int main(int argc, char** argv) {
// Initialize MPI
TempestInitialize(&argc, &argv);
try {
// Model height cap.
double dZtop;
// Model scaling parameter
double dEarthScaling;
// Rotation rate of the Earth with X = 1.
double dOmega;
// Reference temperature.
double dT0;
// Temperature lapse rate.
double dGamma;
// Longitude of Schar-type mountain centerpoint.
double dLonM;
// Latitude of Schar-type mountain centerpoint.
double dLatM;
// Maximum Schar-type mountain height.
double dH0;
// Schar-type mountain radius (radians).
double dRM;
// Schar-type mountain oscillation half-width (radians).
double dZetaM;
// Parse the command line
BeginTempestCommandLine("StationaryMountainFlowTest");
SetDefaultResolution(30);
SetDefaultLevels(30);
SetDefaultOutputDeltaT("1d");
SetDefaultDeltaT("300s");
SetDefaultEndTime("6d");
SetDefaultHorizontalOrder(4);
SetDefaultVerticalOrder(1);
CommandLineDouble(dZtop, "ztop", 30000.0);
CommandLineDouble(dEarthScaling, "X", 1.0);
CommandLineDouble(dOmega, "omega", 0.0);
CommandLineDouble(dT0, "T0", 300.0);
CommandLineDouble(dGamma, "Gamma", 0.0065);
CommandLineDouble(dLonM, "lonm", 270.0);
CommandLineDouble(dLatM, "latm", 0.0);
CommandLineDouble(dH0, "h0", 2000.0);
CommandLineDouble(dRM, "rm", 135.0);
CommandLineDouble(dZetaM, "zetam", 11.25);
ParseCommandLine(argc, argv);
EndTempestCommandLine(argv)
// Setup the Model
AnnounceBanner("MODEL SETUP");
Model model(EquationSet::PrimitiveNonhydrostaticEquations);
TempestSetupCubedSphereModel(model);
// Set the test case for the model
AnnounceStartBlock("Initializing test case");
model.SetTestCase(
new StationaryMountainFlowTest(
dZtop,
dEarthScaling,
dOmega,
dT0,
dGamma,
dLonM,
dLatM,
dH0,
dRM,
dZetaM));
AnnounceEndBlock("Done");
// Set the reference length
model.GetGrid()->SetReferenceLength(0.5 * M_PI / 30.0 * dEarthScaling);
// Begin execution
AnnounceBanner("SIMULATION");
model.Go();
// Compute error norms
AnnounceBanner("RESULTS");
model.ComputeErrorNorms();
AnnounceBanner();
} catch(Exception & e) {
std::cout << e.ToString() << std::endl;
}
//.........这里部分代码省略.........