本文整理匯總了C++中AfxEnableControlContainer函數的典型用法代碼示例。如果您正苦於以下問題:C++ AfxEnableControlContainer函數的具體用法?C++ AfxEnableControlContainer怎麽用?C++ AfxEnableControlContainer使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了AfxEnableControlContainer函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: CSingleDocTemplate
BOOL CFaceEncryptApp::InitInstance()
{
//AfxMessageBox("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_CHOOSEOPERATION_TMPL,
RUNTIME_CLASS(CFaceEncryptDoc), // document class
RUNTIME_CLASS(CMainFrame), // frame class
RUNTIME_CLASS(CChooseOperation)); // 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(CFaceEncryptDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CFaceEncryptView));
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
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();
// Enable drag/drop open
m_pMainWnd->DragAcceptFiles();
return TRUE;
}
示例2: sizeof
BOOL CCheckExamApp::InitInstance()
{
// 如果一個運行在 Windows XP 上的應用程序清單指定要
// 使用 ComCtl32.dll 版本 6 或更高版本來啟用可視化方式,
//則需要 InitCommonControlsEx()。 否則,將無法創建窗口。
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(InitCtrls);
// 將它設置為包括所有要在應用程序中使用的
// 公共控件類。
InitCtrls.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);
CWinApp::InitInstance();
AfxEnableControlContainer();
// 創建 shell 管理器,以防對話框包含
// 任何 shell 樹視圖控件或 shell 列表視圖控件。
CShellManager *pShellManager = new CShellManager;
// 激活“Windows Native”視覺管理器,以便在 MFC 控件中啟用主題
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));
// 標準初始化
// 如果未使用這些功能並希望減小
// 最終可執行文件的大小,則應移除下列
// 不需要的特定初始化例程
// 更改用於存儲設置的注冊表項
// TODO: 應適當修改該字符串,
// 例如修改為公司或組織名
SetRegistryKey(_T("應用程序向導生成的本地應用程序"));
CCheckExamDlg dlg;
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: 在此放置處理何時用
// “確定”來關閉對話框的代碼
}
else if (nResponse == IDCANCEL)
{
// TODO: 在此放置處理何時用
// “取消”來關閉對話框的代碼
}
else if (nResponse == -1)
{
TRACE(traceAppMsg, 0, "警告: 對話框創建失敗,應用程序將意外終止。\n");
TRACE(traceAppMsg, 0, "警告: 如果您在對話框上使用 MFC 控件,則無法 #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS。\n");
}
// 刪除上麵創建的 shell 管理器。
if (pShellManager != NULL)
{
delete pShellManager;
}
// 由於對話框已關閉,所以將返回 FALSE 以便退出應用程序,
// 而不是啟動應用程序的消息泵。
return FALSE;
}
示例3: ParseCommandLine
BOOL CFPAnalysisApp::InitInstance()
{
// CG: The following block was added by the Splash Screen component.
\
{
\
CCommandLineInfo cmdInfo;
\
ParseCommandLine(cmdInfo);
\
\
CSplashWnd::EnableSplashScreen(cmdInfo.m_bShowSplash);
\
}
AfxEnableControlContainer();
//m_dlgSkin.Create(IDD_SKINDIALOG_DIALOG);
//m_pSkin = m_dlgSkin.GetDlgItem(IDC_SKIN2)->GetControlUnknown();
//m_dlgAgent.Create(IDD_AGENT_DIALOG);
//m_theAgent.Probe(&m_dlgAgent.m_Agent);
// 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("Fingerprint Analysis 1.00"));
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.
CMultiDocTemplate* pDocTemplate;
pDocTemplate = new CMultiDocTemplate(
IDR_FPANALTYPE,
RUNTIME_CLASS(CFPAnalysisDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CFPAnalysisView));
AddDocTemplate(pDocTemplate);
EnableShellOpen();
// create main MDI Frame window
CMainFrame* pMainFrame = new CMainFrame;
if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
return FALSE;
m_pMainWnd = pMainFrame;
//Drag & Drop support
m_pMainWnd->DragAcceptFiles();
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// no new document at start-up
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
// The main window has been initialized, so show and update it.
pMainFrame->ShowWindow(m_nCmdShow);
pMainFrame->CenterWindow();
pMainFrame->UpdateWindow();
pMainFrame->SetTitle("Fingerprint Analysis");
return TRUE;
}
示例4: AfxEnableControlContainer
BOOL CLibraryApp::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)
//Login Dialog
CLoginDlg cLoginDlg;
/*
if(cLoginDlg.DoModal() != IDOK)
return false;
*/
// 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(CLibraryDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CLibraryView));
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;
if(!cLoginDlg.IsUserType())
{
CMenu *menu = m_pMainWnd->GetMenu();
menu->DeleteMenu(0,MF_BYPOSITION);
m_pMainWnd->DrawMenuBar(); //ÖØ»æ²Ëµ¥À¸
}
// The one and only window has been initialized, so show and update it.
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
return TRUE;
}
示例5: AfxEnableControlContainer
BOOL CApp::InitInstance()
{
if(!CDCGFApp::InitInstance()) 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.
/*
#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("DEAD:CODE"));
LoadStdProfileSettings(8); // Load standard INI file options (including MRU)
CDCGFStringTable::Init();
// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views.
CMultiDocTemplate* pDocTemplate;
pDocTemplate = new CMultiDocTemplate(
IDR_PROJECTYPE,
RUNTIME_CLASS(CProjectDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CProjectView));
AddDocTemplate(pDocTemplate);
// create main MDI Frame window
CMainFrame* pMainFrame = new CMainFrame;
if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
return FALSE;
m_pMainWnd = pMainFrame;
// Enable drag/drop open
//m_pMainWnd->DragAcceptFiles();
// This code replaces the MFC created menus with
// the Ownerdrawn versions
static UINT toolbars[]={
IDR_MAINFRAME, IDR_TOOLBAR_2
};
pDocTemplate->m_hMenuShared=pMainFrame->NewMenu(IDR_PROJECTYPE, toolbars, 2);
pMainFrame->m_hMenuDefault=pMainFrame->NewDefaultMenu(IDR_MAINFRAME, toolbars, 2);
/*
CDCGFStringTable::LocMenu(CMenu::FromHandle(pMainFrame->m_hMenuDefault));
CDCGFStringTable::LocMenu(CMenu::FromHandle(pDocTemplate->m_hMenuShared));
*/
// This simulates a window being opened if you don't have
// a default window displayed at startup
pMainFrame->OnUpdateFrameMenu(pMainFrame->m_hMenuDefault);
// Enable DDE Execute open
EnableShellOpen();
RegisterShellFileTypes(FALSE);
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
if(cmdInfo.m_nShellCommand==CCommandLineInfo::FileNew)
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
// The main window has been initialized, so show and update it.
pMainFrame->ShowWindow(SW_SHOWMAXIMIZED);
pMainFrame->UpdateWindow();
if(cmdInfo.m_nShellCommand == CCommandLineInfo::FileNothing)
{
DoSomeNagging();
if(GetRegInt(HKEY_CURRENT_USER, DCGF_TOOLS_REG_PATH, "AutoCheckUpdates", 1))
{
pMainFrame->CheckForUpdates(true);
}
}
pMainFrame->UpdateMenuURL(pMainFrame->GetMenu());
return TRUE;
}
示例6: CheckUpgrade
//.........這裏部分代碼省略.........
}
return FALSE;
}
if (CAppUtils::GetMsysgitVersion() < 0x01070a00)
{
int ret = CMessageBox::ShowCheck(NULL, IDS_PROC_OLDMSYSGIT, IDS_APPNAME, 1, IDI_EXCLAMATION, IDS_PROC_GOTOMSYSGITWEBSITE, IDS_ABORTBUTTON, IDS_IGNOREBUTTON, _T("OldMsysgitVersionWarning"), IDS_PROC_NOTSHOWAGAINIGNORE);
if (ret == 1)
{
CMessageBox::RemoveRegistryKey(_T("OldMsysgitVersionWarning")); // only store answer if it is "Ignore"
ShellExecute(NULL, NULL, _T("http://code.google.com/p/msysgit/"), NULL, NULL, SW_SHOW);
return FALSE;
}
else if (ret == 2)
{
CMessageBox::RemoveRegistryKey(_T("OldMsysgitVersionWarning")); // only store answer if it is "Ignore"
return FALSE;
}
}
// InitCommonControls() 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 used = {
sizeof(INITCOMMONCONTROLSEX),
ICC_ANIMATE_CLASS | ICC_BAR_CLASSES | ICC_COOL_CLASSES | ICC_DATE_CLASSES |
ICC_HOTKEY_CLASS | ICC_INTERNET_CLASSES | ICC_LISTVIEW_CLASSES |
ICC_NATIVEFNTCTL_CLASS | ICC_PAGESCROLLER_CLASS | ICC_PROGRESS_CLASS |
ICC_TAB_CLASSES | ICC_TREEVIEW_CLASSES | ICC_UPDOWN_CLASS |
ICC_USEREX_CLASSES | ICC_WIN95_CLASSES
};
InitCommonControlsEx(&used);
AfxOleInit();
AfxEnableControlContainer();
AfxInitRichEdit2();
CWinAppEx::InitInstance();
SetRegistryKey(_T("TortoiseGit"));
AfxGetApp()->m_pszProfileName = _tcsdup(_T("TortoiseProc")); // w/o this ResizableLib will store data under TortoiseGitProc which is not compatible with older versions
CCmdLineParser parser(AfxGetApp()->m_lpCmdLine);
hWndExplorer = NULL;
CString sVal = parser.GetVal(_T("hwnd"));
if (!sVal.IsEmpty())
hWndExplorer = (HWND)_ttoi64(sVal);
while (GetParent(hWndExplorer)!=NULL)
hWndExplorer = GetParent(hWndExplorer);
if (!IsWindow(hWndExplorer))
{
hWndExplorer = NULL;
}
// if HKCU\Software\TortoiseGit\Debug is not 0, show our command line
// in a message box
if (CRegDWORD(_T("Software\\TortoiseGit\\Debug"), FALSE)==TRUE)
AfxMessageBox(AfxGetApp()->m_lpCmdLine, MB_OK | MB_ICONINFORMATION);
if ( parser.HasKey(_T("path")) && parser.HasKey(_T("pathfile")))
{
CMessageBox::Show(NULL, IDS_ERR_INVALIDPATH, IDS_APPNAME, MB_ICONERROR);
return FALSE;
}
CTGitPath cmdLinePath;
CTGitPathList pathList;
示例7: sizeof
BOOL CWinLauncher2App::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();
AfxEnableControlContainer();
// Create the shell manager, in case the dialog contains
// any shell tree view or shell list view controls.
CShellManager *pShellManager = new CShellManager;
// Activate "Windows Native" visual manager for enabling themes in MFC controls
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));
// Set CWinApp default registry key. Must be consistent with all apps using findjava2.
SetRegistryKey(_T("Android-FindJava2"));
// Use VERSIONINFO.FileDescription as the canonical app name
initUtils(NULL);
CLauncherCmdLineInfo cmdLine;
ParseCommandLine(cmdLine);
if (cmdLine.mDoHelp) {
const TCHAR *msg =
_T("WinLauncher2 [/7|/f|/h]\r\n")
_T("/7 : Requires Java 1.7 instead of 1.6\r\n")
_T("/f : Force UI\r\n")
_T("/h : Help\r\n");
AfxMessageBox(msg);
return FALSE; // quit without starting MFC app msg loop
}
CJavaFinder javaFinder(JAVA_VERS_TO_INT(1, cmdLine.mDoJava1_7 ? 7 : 6));
CJavaPath javaPath = javaFinder.getRegistryPath();
if (cmdLine.mDoForceUi || javaPath.isEmpty()) {
javaPath.clear();
CFindJava2Dlg dlg;
dlg.setJavaFinder(&javaFinder);
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();
if (nResponse == IDOK) {
// Use choice selected by user and save in registry.
javaPath = dlg.getSelectedPath();
javaFinder.setRegistryPath(javaPath);
} else if (nResponse == IDCANCEL) {
// Canceled by user, exit silently.
} else if (nResponse == -1) {
TRACE(traceAppMsg, 0, "Warning: dialog creation failed, so application is terminating unexpectedly.\n");
}
}
if (!javaPath.isEmpty()) {
// TODO actually launch configured app instead of just printing path.
CString msg(_T("PLACEHOLDER TODO run app using "));
msg.Append(javaPath.mPath);
AfxMessageBox(msg);
}
// Delete the shell manager created above.
if (pShellManager != NULL) {
delete pShellManager;
}
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}
示例8: LoadLibrary
BOOL KSceneEditorApp::InitInstance()
{
BOOL bResult = false;
BOOL bRetCode = false;
HRESULT hr = E_FAIL;
char* pszRetCWD = NULL;
IRecorderFactory* piRecorderFactory = NULL;
CMultiDocTemplate* pDocTemplate = NULL;
MFCFramework::CMainFrame* pMainFrame = NULL;
KGLOG_PARAM LogParam;
char szCWD[MAX_PATH];
CCommandLineInfo cmdInfo;
//使用Dummper
m_hDummperModule = LoadLibrary(_T("dumper.dll"));
pszRetCWD = getcwd(szCWD, sizeof(szCWD));
KGLOG_PROCESS_ERROR(pszRetCWD);
g_SetRootPath();
g_SetFindFileMode(TRUE);
g_SetFilePath("");
g_LoadPackageFiles("config.ini", "PackFile");
memset(&LogParam, 0, sizeof(LogParam));
snprintf(LogParam.szPath,sizeof(LogParam.szPath),"%s\\logs",szCWD);
LogParam.szPath[sizeof(LogParam.szPath) - 1] = '\0';
strcpy(LogParam.szIdent, "SceneEditor");
LogParam.nMaxLineEachFile = 65536;
LogParam.Options = (KGLOG_OPTIONS)KGLOG_OPTION_FILE;
bRetCode = KGLogInit(LogParam, NULL);
KGLOG_PROCESS_ERROR(bRetCode);
m_bLogInitFlag = true;
bRetCode = KMemory::Initialize("SceneEditor.memory");
KGLOG_PROCESS_ERROR(bRetCode);
m_bMemoryInitFlag = true;
g_cEditorDirectory.Load();
{
TCHAR AppDir[256] = {0};
GetCurrentDirectory(256, AppDir);
wsprintf(g_szDefWorkDirectory,"%s\\",AppDir);
wsprintf(g_szDefExeDirectory,"%s\\",AppDir);
}
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(10); // 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.
pDocTemplate = new CMultiDocTemplate(
IDR_SCENEETYPE,
RUNTIME_CLASS(KSceneEditorDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(KSceneEditorView));
pDocTemplate->SetContainerInfo(IDR_SCENEETYPE_CNTR_IP);
AddDocTemplate(pDocTemplate);
pDocTemplate = new CMultiDocTemplate(
IDR_MESHETYPE,
RUNTIME_CLASS(KSceneModelEditorDoc),
RUNTIME_CLASS(KSceneModelEditorFrameWnd), // custom MDI child frame
RUNTIME_CLASS(KSceneModelEditorView));
pDocTemplate->SetContainerInfo(IDR_SCENEETYPE_CNTR_IP);
AddDocTemplate(pDocTemplate);
pDocTemplate = new CMultiDocTemplate(
IDS_OBJECTTYPE,
RUNTIME_CLASS(KSceneObjectEditorDoc),
RUNTIME_CLASS(KSceneObjectEditorFrameWnd), // custom MDI child frame
RUNTIME_CLASS(KSceneObjectEditorView));
pDocTemplate->SetContainerInfo(IDR_SCENEETYPE_CNTR_IP);
AddDocTemplate(pDocTemplate);
pDocTemplate = new CMultiDocTemplate(
IDR_SFXEDITOR,
RUNTIME_CLASS(KSceneSFXEditorDoc),
RUNTIME_CLASS(KSceneSFXEditorFrame), // custom MDI child frame
RUNTIME_CLASS(KSceneSFXEditorView));
pDocTemplate->SetContainerInfo(IDR_SFXEDITOR);
AddDocTemplate(pDocTemplate);
//.........這裏部分代碼省略.........
示例9: AfxMessageBox
BOOL CRemoteMediaClientApp::InitInstance()
{
if (!cmVLPLogStartup(_T("RMCRunning.log")))
{
AfxMessageBox(IDS_INITLOGMODERR, MB_OK | MB_ICONWARNING);
}
// 如果一個運行在 Windows XP 上的應用程序清單指定要
// 使用 ComCtl32.dll 版本 6 或更高版本來啟用可視化方式,
//則需要 InitCommonControlsEx()。否則,將無法創建窗口。
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(InitCtrls);
// 將它設置為包括所有要在應用程序中使用的
// 公共控件類。
InitCtrls.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);
CWinApp::InitInstance();
AfxEnableControlContainer();
// 創建 shell 管理器,以防對話框包含
// 任何 shell 樹視圖控件或 shell 列表視圖控件。
CShellManager *pShellManager = new CShellManager;
// 標準初始化
// 如果未使用這些功能並希望減小
// 最終可執行文件的大小,則應移除下列
// 不需要的特定初始化例程
// 更改用於存儲設置的注冊表項
// TODO: 應適當修改該字符串,
// 例如修改為公司或組織名
SetRegistryKey(_T("UBiTerSoft\\RemoteMedia"));
CRemoteMediaClientDlg dlg;
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: 在此放置處理何時用
// “確定”來關閉對話框的代碼
}
else if (nResponse == IDCANCEL)
{
// TODO: 在此放置處理何時用
// “取消”來關閉對話框的代碼
}
// 刪除上麵創建的 shell 管理器。
if (pShellManager != NULL)
{
delete pShellManager;
}
cmVLPLogShutdown();
// 由於對話框已關閉,所以將返回 FALSE 以便退出應用程序,
// 而不是啟動應用程序的消息泵。
return FALSE;
}
示例10: sizeof
BOOL CAVTCameraManipulateApp::InitInstance()
{
// 如果一個運行在 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;
}
AfxEnableControlContainer();
// 創建 shell 管理器,以防對話框包含
// 任何 shell 樹視圖控件或 shell 列表視圖控件。
CShellManager *pShellManager = new CShellManager;
// 標準初始化
// 如果未使用這些功能並希望減小
// 最終可執行文件的大小,則應移除下列
// 不需要的特定初始化例程
// 更改用於存儲設置的注冊表項
// TODO: 應適當修改該字符串,
// 例如修改為公司或組織名
SetRegistryKey(_T("應用程序向導生成的本地應用程序"));
vmbError = VmbStartup();
if (VmbErrorSuccess != vmbError)
{
AfxMessageBox(_T("Vimba Startup Error!"));
}
CAVTCameraManipulateDlg dlg;
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: 在此放置處理何時用
// “確定”來關閉對話框的代碼
}
else if (nResponse == IDCANCEL)
{
// TODO: 在此放置處理何時用
// “取消”來關閉對話框的代碼
}
// 刪除上麵創建的 shell 管理器。
if (pShellManager != NULL)
{
delete pShellManager;
}
// 由於對話框已關閉,所以將返回 FALSE 以便退出應用程序,
// 而不是啟動應用程序的消息泵。
return FALSE;
}
示例11: sizeof
BOOL CbaltoshopApp::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();
// 표준 초기화
// 이들 기능을 사용하지 않고 최종 실행 파일의 크기를 줄이려면
// 아래에서 필요 없는 특정 초기화
// 루틴을 제거해야 합니다.
// 해당 설정이 저장된 레지스트리 키를 변경하십시오.
// 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(CbaltoshopDoc),
RUNTIME_CLASS(CMainFrame), // 주 SDI 프레임 창입니다.
RUNTIME_CLASS(CbaltoshopView));
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 후에 이러한 호출이 발생해야 합니다.
return TRUE;
}
示例12: CloseHandle
BOOL CHeavenShadowApp::InitInstance()
{
//////////////////////////////////////////////////////////////////////////
HANDLE hMutex = ::CreateMutexW(NULL,TRUE,HS_ONLY_ONE_PROCESS);
if (GetLastError() == ERROR_ALREADY_EXISTS)
{
::MessageBox(
NULL,
L"您已經運行了天影衛士!",
L"天影衛士",
0
); //彈出對話框確認不能運行第二個實例。
CloseHandle(hMutex);
ExitProcess(0);
}
if (HsIs64BitWindows() == TRUE && sizeof(ULONG_PTR) == sizeof(ULONG32))
{
::MessageBox(
NULL,
L"您在使用 64 位的 Windows 操作係統。運行天影衛士 32 位版\r\n可能會造成不可預料的後果。敬請選擇天影衛士 64 位版。",
L"天影衛士",
0
);
ExitProcess(0);
}
//////////////////顯示Splash,2010-10-15///////////////////////////////////
CWzdSplash wndSplash; //創建啟動窗口類的實例
wndSplash.Create(IDB_BITMAP_WZDSPLASH);
wndSplash.CenterWindow();
wndSplash.UpdateWindow(); //send WM_PAINT
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
// 如果一個運行在 Windows XP 上的應用程序清單指定要
// 使用 ComCtl32.dll 版本 6 或更高版本來啟用可視化方式,
//則需要 InitCommonControlsEx()。否則,將無法創建窗口。
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(InitCtrls);
// 將它設置為包括所有要在應用程序中使用的
// 公共控件類。
InitCtrls.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);
CWinApp::InitInstance();
AfxEnableControlContainer();
// 創建 shell 管理器,以防對話框包含
// 任何 shell 樹視圖控件或 shell 列表視圖控件。
CShellManager *pShellManager = new CShellManager;
// 標準初始化
// 如果未使用這些功能並希望減小
// 最終可執行文件的大小,則應移除下列
// 不需要的特定初始化例程
// 更改用於存儲設置的注冊表項
// TODO: 應適當修改該字符串,
// 例如修改為公司或組織名
SetRegistryKey(_T("天影衛士"));
//////////////////////////////////////////////////////////////////////////
// WCHAR *Temp = AfxGetApp()->m_lpCmdLine;
//
// BOOL bIsHideWnd = FALSE;
//
// if (wcslen(Temp))
// {
// WCHAR* p = Temp;
//
// for (int i = 0; i< wcslen(Temp); i++)
// {
// if (_wcsnicmp(p,L"-HideWnd",wcslen(L"-HideWnd"))==0)
// {
// bIsHideWnd = TRUE;
// }
// p++;
// }
// }
// CHeavenShadowDlg* dlg = new CHeavenShadowDlg();
//
// m_pMainWnd = dlg;
//
// INT_PTR nResponse = dlg->Create(IDD_HEAVENSHADOW_DIALOG);
//
// dlg->ShowWindow(SW_HIDE);
//
// return FALSE;
//.........這裏部分代碼省略.........
示例13: sizeof
BOOL CGraphShowerApp::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();
// 標準初始化
// 如果未使用這些功能並希望減小
// 最終可執行文件的大小,則應移除下列
// 不需要的特定初始化例程
// 更改用於存儲設置的注冊表項
// TODO: 應適當修改該字符串,
// 例如修改為公司或組織名
SetRegistryKey(_T("應用程序向導生成的本地應用程序"));
LoadStdProfileSettings(4); // 加載標準 INI 文件選項(包括 MRU)
// 注冊應用程序的文檔模板。文檔模板
// 將用作文檔、框架窗口和視圖之間的連接
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CGraphShowerDoc),
RUNTIME_CLASS(CMainFrame), // 主 SDI 框架窗口
RUNTIME_CLASS(CGraphShowerView));
if (!pDocTemplate)
return FALSE;
AddDocTemplate(pDocTemplate);
//------------------------------------------------------------------------------
// GDI+圖像庫初始化
GdiplusStartup(&m_GdiplusToken, &m_GdiplusStartupInput, NULL);
//------------------------------------------------------------------------------
// 分析標準外殼命令、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 之後發生
return TRUE;
}
示例14: SetRegistryKey
BOOL CPBXClientApp::InitInstance()
{
// 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(REG_KEY_APP);
CString lang = GetProfileString("Settings", "Language", "");
SetLanguage(lang);
CString cmdLine = this->m_lpCmdLine;
HWND hwnd = FindWindow(NULL, _T("BSOC Main Application Window"));
m_bShellOpenFile = FALSE;
m_bAllowCmdLineOriginate = 1;
m_bDeveloperVersion = TRUE;
if (cmdLine.Left(9).MakeLower()=="originate") {
Semaphore s(ORIGINATE_FILE_MUTEX);
CStdioFile debugFile(::theApp.GetInstallDir()+"\\originate.tmp", CFile::modeCreate | CFile::modeWrite);
debugFile.SeekToEnd();
debugFile.WriteString(cmdLine);
debugFile.Close();
return TRUE;
}
if (hwnd!=NULL) { //only one instance of OutCALL can be run
CString str;
str.Format(_("%s is already running."), APP_NAME);
MessageBox(NULL, str, APP_NAME, MB_ICONINFORMATION | MB_OK);
return FALSE;
}
WSADATA WSAData = { 0 };
if ( 0 != WSAStartup( WSA_VERSION, &WSAData ) )
{
// Tell the user that we could not find a usable
// WinSock DLL.
if ( LOBYTE( WSAData.wVersion ) != LOBYTE(WSA_VERSION) ||
HIBYTE( WSAData.wVersion ) != HIBYTE(WSA_VERSION) )
::MessageBox(NULL, _("Incorrect version of WS2_32.dll found."), APP_NAME, MB_OK | MB_ICONERROR);
WSACleanup( );
return FALSE;
}
if (_tcscmp(this->m_lpCmdLine, _T("background"))==0) {
Sleep(10000);
} else if (cmdLine!="") {
m_bShellOpenFile = TRUE;
ReadConfigFile(cmdLine);
}
AfxOleInit();
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
CMainFrame* pFrame = new CMainFrame;
m_pMainWnd = pFrame;
pFrame->CreateDatabaseTable("RecivedCalls", "CREATE TABLE RecivedCalls(Date TEXT, Time TEXT, Callee TEXT, CallerID TEXT, Sec NUMERIC)");
pFrame->CreateDatabaseTable("PlacedCalls", "CREATE TABLE PlacedCalls(Date TEXT, Time TEXT, Callee TEXT, CallerID TEXT, Sec NUMERIC)");
pFrame->CreateDatabaseTable("MissedCalls", "CREATE TABLE MissedCalls(NewCall NUMERIC, Date TEXT, Time TEXT, Callee TEXT, CallerID TEXT, Sec NUMERIC)");
pFrame->CreateDatabaseTable("Contacts", "CREATE TABLE Contacts(Title TEXT, FirstName TEXT, MiddleName TEXT, LastName TEXT, Suffix TEXT, CompanyName TEXT, Assistant TEXT, Business TEXT, Business2 TEXT, BusinessFax TEXT, Callback TEXT, Car TEXT, Company TEXT, Home TEXT, Home2 TEXT, HomeFax TEXT, ISDN TEXT, Mobile TEXT, Other TEXT, OtherFax TEXT, Pager TEXT, PrimaryTel TEXT, Radio TEXT, Telex TEXT, TTYTDD TEXT)");
// create and load the frame with its resources
int left = (GetSystemMetrics(SM_CXSCREEN)-500)/2;
int top = (GetSystemMetrics(SM_CYSCREEN)-500)/2;
pFrame->LoadFrame(IDR_MAINFRAME,
WS_OVERLAPPEDWINDOW | WS_MINIMIZE | FWS_ADDTOTITLE, NULL,
NULL);
pFrame->MoveWindow(left, top, left+500, top+500);
// The one and only window has been initialized, so show and update it.
pFrame->ShowWindow(SW_HIDE);
pFrame->UpdateWindow();
//pFrame->SetWindowPos(&pFrame->wndTopMost,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
this->m_pMainWnd = pFrame;
// To create the main window, this code creates a new frame window
// object and then sets it as the application's main window object.
IntegrateIntoOutlook();
//.........這裏部分代碼省略.........
示例15: AfxEnableControlContainer
BOOL CVecDemoApp::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.
if (!AfxOleInit())
{
AfxMessageBox("Ole Initialization Failed");
return FALSE;
}
HDC hdc=GetDC(NULL);
ASSERT(hdc!=NULL);
int bpp = GetDeviceCaps(hdc, BITSPIXEL);
ReleaseDC(NULL, hdc);
if(bpp <= 8)
{
AfxMessageBox("This application requires more then 256 colors.");
return FALSE;
}
#if _MSC_VER<8
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
#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("Monfort Software"));
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(CVecDemoDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CVecDemoView));
AddDocTemplate(pDocTemplate);
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// main frame will not show itself on creation
m_nCmdShow = SW_HIDE;
// Dispatch commands specified on the command line
BOOL bFileOpen = FALSE;
if(cmdInfo.m_nShellCommand == CCommandLineInfo::FileOpen)
{
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNew;
bFileOpen = TRUE;
}
if (!ProcessShellCommand(cmdInfo))
return FALSE;
((CMainFrame*)m_pMainWnd)->LoadWorkspace();
// show the main frame with the size that we loded from the registery
m_pMainWnd->ShowWindow(m_nCmdShow);
m_pMainWnd->UpdateWindow();
if(bFileOpen)
{
POSITION pos = pDocTemplate->GetFirstDocPosition();
pDocTemplate->GetNextDoc(pos)->OnOpenDocument(cmdInfo.m_strFileName);
}
else
{
POSITION pos = pDocTemplate->GetFirstDocPosition();
CVecDemoDoc* pAlbDoc = (CVecDemoDoc*)pDocTemplate->GetNextDoc(pos);
pos = pAlbDoc->GetFirstViewPosition();
CVecDemoView* pVecDemoView = (CVecDemoView*) pAlbDoc->GetNextView(pos);
pVecDemoView->ClearDocument();
}
return TRUE;
}