Example #1
0
/**
 * @brief Displays main dialog and starts main event loop.
 * @param pszCmdLine - application command line.
 * @param nCmdShow - specifies how the window is to be shown.
 */
int Run(PTSTR pszCmdLine = NULL, int nCmdShow = SW_SHOWDEFAULT)
{
	pszCmdLine;
	nCmdShow;

	CMessageLoop theLoop;
	_Module.AddMessageLoop(&theLoop);

	CMainDlg dlgMain;

	if (dlgMain.Create(NULL) == NULL)
	{
		ATLTRACE(_T("Main dialog creation failed!\n"));
		return 0;
	}
	dlgMain.RestoreWindowSettings(nCmdShow);

	int nRet = theLoop.Run();
	_Module.RemoveMessageLoop();

	return nRet;
}