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


C++ CMainDlg::DoModal方法代码示例

本文整理汇总了C++中CMainDlg::DoModal方法的典型用法代码示例。如果您正苦于以下问题:C++ CMainDlg::DoModal方法的具体用法?C++ CMainDlg::DoModal怎么用?C++ CMainDlg::DoModal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CMainDlg的用法示例。


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

示例1: ShowMainWnd

extern "C" __declspec(dllexport) BOOL ShowMainWnd()
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());

	CoInitialize(NULL);
	AfxEnableControlContainer();
	AfxInitRichEdit();

	CMainDlg dlg;
	theApp.m_pMainWnd = &dlg;

	//GDI+
	ULONG_PTR gdiplusToken;
	GdiplusStartupInput gdiplusStartupInput;
	Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);


	if (dlg.DoModal() == -1)
	{
		TRACE(traceAppMsg, 0, "警告: 对话框创建失败,应用程序将意外终止。\n");
		TRACE(traceAppMsg, 0, "警告: 如果您在对话框上使用 MFC 控件,则无法 #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS。\n");
		return FALSE;
	}

	//关闭gdiplus的环境
	Gdiplus::GdiplusShutdown(gdiplusToken);

	if (theApp.IsUpdata)
	{
		return -1;
	}
	
	return TRUE;
}
开发者ID:ShadowViolet,项目名称:VoreManager,代码行数:34,代码来源:Shadow.cpp

示例2: _tWinMain

int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR /*lpstrCmdLine*/, int /*nCmdShow*/)
{
	HRESULT hRes = ::CoInitialize(NULL);
// If you are running on NT 4.0 or higher you can use the following call instead to 
// make the EXE free threaded. This means that calls come in on a random RPC thread.
//	HRESULT hRes = ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
	ATLASSERT(SUCCEEDED(hRes));

	// this resolves ATL window thunking problem when Microsoft Layer for Unicode (MSLU) is used
	::DefWindowProc(NULL, 0, 0, 0L);

	AtlInitCommonControls(ICC_BAR_CLASSES);	// add flags to support other controls

	hRes = _Module.Init(NULL, hInstance);
	ATLASSERT(SUCCEEDED(hRes));

	int nRet = 0;
	// BLOCK: Run application
	{
		CMainDlg dlgMain;
		nRet = dlgMain.DoModal();
	}

	_Module.Term();
	::CoUninitialize();

	return nRet;
}
开发者ID:Junch,项目名称:wtl,代码行数:28,代码来源:NetworkDrive.cpp

示例3: InitInstance

//--------------------------------------------------------------------------------
BOOL CTokenEditorApp::InitInstance()
	{
	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

	CGenRandomTable tbl;

	CMainDlg dlg;
	m_pMainWnd = &dlg;
	int nResponse = dlg.DoModal();

	// Since the dialog has been closed, return FALSE so that we exit the
	//  application, rather than start the application's message pump.
	return FALSE;
	}
开发者ID:richschonthal,项目名称:Security-Server,代码行数:30,代码来源:TokenEditor.cpp

示例4: InitInstance

BOOL CYTGetApp::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
	Init();

	CMainDlg dlg;
	m_pMainWnd = &dlg;
	int nResponse = dlg.DoModal();
	if (nResponse == IDOK)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with OK
	}
	else if (nResponse == IDCANCEL)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with Cancel
	}
	DeInit();
	// Since the dialog has been closed, return FALSE so that we exit the
	//  application, rather than start the application's message pump.
	return FALSE;
}
开发者ID:killbug2004,项目名称:cosps,代码行数:34,代码来源:YTGet.cpp

示例5: _tWinMain

int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR /*lpstrCmdLine*/, int /*nCmdShow*/)
{
	HRESULT hRes = ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
	ATLASSERT(SUCCEEDED(hRes));

	// this resolves ATL window thunking problem when Microsoft Layer for Unicode (MSLU) is used
	::DefWindowProc(NULL, 0, 0, 0L);

	AtlInitCommonControls(ICC_BAR_CLASSES);	// add flags to support other controls

	hRes = _Module.Init(NULL, hInstance);
	ATLASSERT(SUCCEEDED(hRes));

	int nRet = 0;
	// BLOCK: Run application
	{
		CMainDlg dlgMain;
		nRet = dlgMain.DoModal();
	}

	_Module.Term();
	::CoUninitialize();

	return nRet;
}
开发者ID:BBLN,项目名称:VirtualKD,代码行数:25,代码来源:vminstall.cpp

示例6: _tWinMain

int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int nCmdShow)
{
	HRESULT hRes = ::CoInitialize(NULL);
// If you are running on NT 4.0 or higher you can use the following call instead to 
// make the EXE free threaded. This means that calls come in on a random RPC thread.
//	HRESULT hRes = ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
	ATLASSERT(SUCCEEDED(hRes));

	// this resolves ATL window thunking problem when Microsoft Layer for Unicode (MSLU) is used
	::DefWindowProc(NULL, 0, 0, 0L);

	AtlInitCommonControls(ICC_BAR_CLASSES);	// add flags to support other controls

	//hRes = _Module.Init(NULL, hInstance);
	GUID guid;
	hRes = _Module.Init(NULL,hInstance,&guid);
	ATLASSERT(SUCCEEDED(hRes));

	BkString::Load(IDR_BK_STRING_DEF);
	BkFontPool::SetDefaultFont(BkString::Get(IDS_APP_FONT), -12);
	BkSkin::LoadSkins(IDR_BK_SKIN_DEF);
	BkStyle::LoadStyles(IDR_BK_STYLE_DEF);

	CMainDlg dlgMain;
	dlgMain.DoModal();

	_Module.Term();
	::CoUninitialize();

	return 0;
}
开发者ID:hua3505,项目名称:tinyBrowser,代码行数:31,代码来源:tinyBrowser.cpp

示例7: InitInstance

BOOL CThisApp::InitInstance()
{
	CWinApp::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
	// 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"));

	CMainDlg dlg;
	m_pMainWnd = &dlg;
	INT_PTR nResponse = dlg.DoModal();
	if (nResponse == IDOK)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with OK
	}
	else if (nResponse == IDCANCEL)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with Cancel
	}

	// Since the dialog has been closed, return FALSE so that we exit the
	//  application, rather than start the application's message pump.
	return FALSE;
}
开发者ID:abidbodal,项目名称:firmware_upgrader_k20,代码行数:31,代码来源:win_hc08sprg.cpp

示例8: _tWinMain

int WINAPI _tWinMain( HINSTANCE hInst, HINSTANCE, LPTSTR, int )
{
	_tsetlocale( LC_ALL, _T(".OCP") );

	ATLVERIFY( SUCCEEDED( _Module.Init( NULL, hInst ) ) );
	if( !EnableDebugPrivilege() )
	{
		MessageBoxV( NULL, IDS_NO_DEBUG_PRIVILEGE, MB_OK | MB_ICONHAND );
		return 0;
	}

	InitializeCriticalSection( &g_cs );
	LoadInternalExceptionList();
	LoadSettings();
	DumpInit();

	if( !ProcessCommandLine() )
	{
		AtlInitCommonControls( ICC_BAR_CLASSES );
		LoadLibrary( CRichEditCtrl::GetLibraryName() );

		CMainDlg dlgMain;
		g_pMainWnd = &dlgMain;
		int nRet = dlgMain.DoModal();
		g_pMainWnd = NULL;
	}

	DumpUninit();
	SaveSettings();
	DeleteCriticalSection( &g_cs );

	_Module.Term();
	return 0;
}
开发者ID:localvar,项目名称:backup,代码行数:34,代码来源:Main.cpp

示例9: _tWinMain

int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR /*lpstrCmdLine*/, int /*nCmdShow*/)
{
	HRESULT hRes = ::CoInitialize(NULL);		//初始化COM
// If you are running on NT 4.0 or higher you can use the following call instead to 
// make the EXE free threaded. This means that calls come in on a random RPC thread.
//	HRESULT hRes = ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
	ATLASSERT(SUCCEEDED(hRes));

	// this resolves ATL window thunking problem when Microsoft Layer for Unicode (MSLU) is used
	::DefWindowProc(NULL, 0, 0, 0L);

	AtlInitCommonControls(ICC_BAR_CLASSES);		// add flags to support other controls

	hRes = _Module.Init(NULL, hInstance);		//全局对象_Module被初始化
	ATLASSERT(SUCCEEDED(hRes));

	BkString::Load(IDR_BK_STRING_DEF);			//加载指定资源ID的string定义xml
	BkFontPool::SetDefaultFont(BkString::Get(IDS_APP_FONT), -12);

	BkSkin::LoadSkins(IDR_BK_SKIN_DEF);			//加载指定资源ID的skin定义xml
	BkStyle::LoadStyles(IDR_BK_STYLE_DEF);		//加载指定资源ID的Style定义xml

	int nRet = 0;
	// BLOCK: Run application, 将CMainDlg变量放在一个区块中是很重要的
	{
		CMainDlg dlgMain;
		nRet = dlgMain.DoModal();
	}

	_Module.Term();
	::CoUninitialize();

	return nRet;
}
开发者ID:liguyu,项目名称:cppexample,代码行数:34,代码来源:LoadAging.cpp

示例10: InitInstance

BOOL CMFCApplicationApp::InitInstance()
{
	// 如果一个运行在 Windows XP 上的应用程序清单指定要
	// 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
	//则需要 InitCommonControlsEx()。  否则,将无法创建窗口。
	INITCOMMONCONTROLSEX InitCtrls;
	InitCtrls.dwSize = sizeof(InitCtrls);
	// 将它设置为包括所有要在应用程序中使用的
	// 公共控件类。
	InitCtrls.dwICC = ICC_WIN95_CLASSES;
	InitCommonControlsEx(&InitCtrls);

	CWinApp::InitInstance();


	// 创建 shell 管理器,以防对话框包含
	// 任何 shell 树视图控件或 shell 列表视图控件。
	CShellManager *pShellManager = new CShellManager;

	// 激活“Windows Native”视觉管理器,以便在 MFC 控件中启用主题
	CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));

	// 标准初始化
	// 如果未使用这些功能并希望减小
	// 最终可执行文件的大小,则应移除下列
	// 不需要的特定初始化例程
	// 更改用于存储设置的注册表项
	// TODO: 应适当修改该字符串,
	// 例如修改为公司或组织名
	SetRegistryKey(_T("应用程序向导生成的本地应用程序"));

	CMainDlg 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;
}
开发者ID:CodeingBoy,项目名称:WIFISharer,代码行数:60,代码来源:MFCApplication1.cpp

示例11: _tWinMain

int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR /*lpstrCmdLine*/, int /*nCmdShow*/)
{
   HRESULT hRes = ::CoInitialize(NULL);
   ATLASSERT(SUCCEEDED(hRes));

   INITCOMMONCONTROLSEX iccx;
   iccx.dwSize = sizeof(iccx);
   iccx.dwICC = ICC_COOL_CLASSES | ICC_BAR_CLASSES;
   BOOL bRet = ::InitCommonControlsEx(&iccx);
   bRet;
   ATLASSERT(bRet);

   hRes = _Module.Init(NULL, hInstance);
   ATLASSERT(SUCCEEDED(hRes));

   int nRet;
   {
      CMainDlg dlgMain;
      nRet = dlgMain.DoModal();
   }

   _Module.Term();
   ::CoUninitialize();

   return nRet;
}
开发者ID:,项目名称:,代码行数:26,代码来源:

示例12: _tWinMain

int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int /*nCmdShow*/)
{
#ifdef _DEBUG
//     bkconsole console;
#endif

   // BkWinManager bkwinmgr;

    BkFontPool::SetDefaultFont(_T("���ו"), -12);

    CString strPath;

    GetModuleFileName((HMODULE)&__ImageBase, strPath.GetBuffer(MAX_PATH + 10), MAX_PATH);
    strPath.ReleaseBuffer();
    strPath.Truncate(strPath.ReverseFind(L'\\') + 1);
    strPath += L"res";

    BkResManager::SetResourcePath(strPath);

    BkSkin::LoadSkins(IDR_BK_SKIN_DEF);
    BkStyle::LoadStyles(IDR_BK_STYLE_DEF);
    BkString::Load(IDR_BK_STRING_DEF);

	CMainDlg dlg;

	HANDLE hEventQuit = NULL;
	HANDLE hSingleProcess = CreateEvent(NULL,FALSE,FALSE,L"quick serach");
	if (GetLastError() == ERROR_ALREADY_EXISTS)
	{
		SetEvent(hSingleProcess);
		goto Exit0;
	}

	KContextSingletion::GetInstance()->m_hInstance = hInstance;
	KContextSingletion::GetInstance()->m_threadPool.Init();

	KJobCreateIndextable* pJobCreateIndextable = new KJobCreateIndextable(NULL);
	KContextSingletion::GetInstance()->m_threadPool.PostJob(pJobCreateIndextable);

	hEventQuit = CreateEvent(NULL,FALSE,FALSE,NULL);
	KJobSingleProcess* pJobSingleProcess = new KJobSingleProcess(hSingleProcess,hEventQuit);
	KContextSingletion::GetInstance()->m_threadPool.PostJob(pJobSingleProcess);

	dlg.DoModal(NULL);

	SetEvent(hEventQuit);
	KContextSingletion::GetInstance()->m_threadPool.UnInit();

Exit0:
	if (hEventQuit != NULL)
	{
		CloseHandle(hEventQuit);
	}
	if (hSingleProcess != NULL)
	{
		CloseHandle(hSingleProcess);
	}

    return 0;
}
开发者ID:killxdcj,项目名称:hello-world,代码行数:60,代码来源:main.cpp

示例13: InitInstance

BOOL CMainApp::InitInstance()
{
	// 如果一个运行在 Windows XP 上的应用程序清单指定要
	// 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
	//则需要 InitCommonControlsEx()。否则,将无法创建窗口。
	INITCOMMONCONTROLSEX InitCtrls;
	InitCtrls.dwSize = sizeof(InitCtrls);
	// 将它设置为包括所有要在应用程序中使用的
	// 公共控件类。
	InitCtrls.dwICC = ICC_WIN95_CLASSES;
	InitCommonControlsEx(&InitCtrls);

	CWinApp::InitInstance();

	g_Profile.Init(theApp);

	AfxEnableControlContainer();

	// 创建 shell 管理器,以防对话框包含
	// 任何 shell 树视图控件或 shell 列表视图控件。
	CShellManager *pShellManager = new CShellManager;

	// 标准初始化
	// 如果未使用这些功能并希望减小
	// 最终可执行文件的大小,则应移除下列
	// 不需要的特定初始化例程
	// 更改用于存储设置的注册表项
	// TODO: 应适当修改该字符串,
	// 例如修改为公司或组织名
	SetRegistryKey(_T("应用程序向导生成的本地应用程序"));

	_tsetlocale(LC_CTYPE, _T("chs"));
	AfxInitRichEdit2();


	CMainDlg 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;
}
开发者ID:SzAllen,项目名称:Iap2,代码行数:59,代码来源:MainApp.cpp

示例14: InitApplication

	virtual BOOL InitApplication()
	{
		CMainDlg dlg;
		dlg.DoModal();
		Dialog2 dlg2;
		dlg2.DoModal();
		//AfxMessageBox("由Win32工程转换而成的MFC软件工程");
		return TRUE;
	}
开发者ID:runninglzw,项目名称:MFC,代码行数:9,代码来源:Create_MFC.cpp

示例15: _tWinMain

int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE, wchar_t* lpstrCmdLine, int nCmdShow){
  HRESULT hRes = ::OleInitialize(NULL);
  ::DefWindowProc(NULL, 0, 0, 0L);
  AtlInitCommonControls(ICC_BAR_CLASSES | ICC_DATE_CLASSES);//Add flags to support other controls
  hRes = _Module.Init(NULL, hInstance);
  int nRet = 0;

  wchar_t pszLoader[MAX_PATH];
  ::GetModuleFileName(NULL, pszLoader, MAX_PATH);
  CheckVersion(pszLoader);

  _6bees_socket::ftpclient ftpClient;
  _6bees_timer::CTimer m_Timer;

  //UPLOADERMODE mode;
  vector<wstring> vec_files;
  //ParseCmdline(stringmaker(CP_ACP)<<lpstrCmdLine,mode,&vec_files);
  if (lpstrCmdLine==NULL){

  }else if (_6bees_str::startwith<wstring>(lpstrCmdLine,L"-m upload ")){
    wstring cmdline(lpstrCmdLine);
    cmdline = cmdline.substr(10);
    vec_files = _6bees_util::Split(cmdline,L"|");
  }

  // 1. If there is an uploader already, then open it and upload
  HWND hwndTo = ::FindWindow(0,_6bees_const::kUploader_WndTitle);
  if(hwndTo){
    wstring filelist;//f will be like:XXX YYY ZZZ
    for(int i=0;i<(int)vec_files.size();i++){
      filelist.append(vec_files[i] + ((i==(int)vec_files.size()-1)?_T(""):_T("\t")));
    }
    SendMsgToUploader(hwndTo,(stringmaker()<<filelist).c_str(),CPYDATA_UPLOAD_2_UPLOAD);
  }else{
    // 2. open a new uploader
    CMainDlg dlgMain;
    int mssize=0;
    if(vec_files.empty()){
      CString strFolderPath,strFileName;
      dlgMain.PopDlgtoSelectFiles(strFolderPath,strFileName,mssize);
    }else{
      for(vector<wstring>::const_iterator i=vec_files.begin();i!=vec_files.end();++i){
        if(!PathIsDirectory(i->c_str()) && PathFileExists(i->c_str()) && GetFileSizeW(i->c_str(),mssize))
        {
          CFileProfile fileProfile(0,i->c_str(),mssize);
          dlgMain.AddUploadFile(fileProfile);
        }
      }
    }
    if(!dlgMain.IsEmpty())
      nRet = (int)dlgMain.DoModal();
  }
                     
  _Module.Term();
  ::OleUninitialize();
  return nRet;
}
开发者ID:henrywoo,项目名称:ultraie,代码行数:57,代码来源:updownloader.cpp


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