コード例 #1
0
ファイル: login.cpp プロジェクト: suckli/recorder
BOOL CLoginApp::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

	CLoginDlg 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
	}

	// Since the dialog has been closed, return FALSE so that we exit the
	//  application, rather than start the application's message pump.
	return FALSE;
}
コード例 #2
0
BOOL CCardManagerApp::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;

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

	//CCardManagerDlg dlg;
	//m_pMainWnd = &dlg;
	CLoginDlg 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;
}
コード例 #3
0
ファイル: EmployeeDlg.cpp プロジェクト: boyuanH/Bank
void CEmployeeDlg::OnCancel() 
{
	// TODO: Add extra cleanup here
	if(MessageBox("确实要退出系统吗?","退出提示",MB_YESNO|MB_ICONQUESTION)==IDYES)
	{
		CDialog::OnCancel();
		CLoginDlg dlg;
		dlg.DoModal();
	}
}
コード例 #4
0
ファイル: QQDemo.cpp プロジェクト: kevinzhwl/duiplant
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR /*lpstrCmdLine*/, int /*nCmdShow*/)
{
	HRESULT hRes = CoInitialize(NULL);
	DUIASSERT(SUCCEEDED(hRes));
 
	TCHAR szCurrentDir[MAX_PATH+1]; memset( szCurrentDir, 0, sizeof(szCurrentDir) );
	GetModuleFileName( NULL, szCurrentDir, MAX_PATH );
	LPTSTR lpInsertPos = _tcsrchr( szCurrentDir, _T('\\') );
	*lpInsertPos = _T('\0');   

	DuiSystem duiSystem(hInstance);
	DefaultLogger loger;
	loger.setLogFilename(CDuiStringT(szCurrentDir)+_T("\\duiengine.log"));
	duiSystem.SetLogger(&loger);

  CMenuWndHook::InstallHook(hInstance,"skin_menuborder");

	duiSystem.logEvent(_T("demo started"));

	#ifdef __DUIFILE_RC 
	//从文件夹加载皮肤,指定皮肤位置
	_tcscat( szCurrentDir, _T("\\..\\skin") );
	DuiResProviderFiles *pResFiles=new DuiResProviderFiles;
	if(!pResFiles->Init(szCurrentDir))
	{
		DUIASSERT(0);
		return 1;
	}
	duiSystem.SetResProvider(pResFiles);
#else 
	//从资源加载皮肤
	duiSystem.SetResProvider(new DuiResProviderPE(hInstance));
#endif 
	BOOL bOK=duiSystem.Init(_T("IDR_DUI_INIT")); //初始化DUI系统,原来的系统初始化方式依然可以使用。
	duiSystem.SetMsgBoxTemplate(_T("IDR_DUI_MSGBOX"));

  DuiWindowFactoryManager::getSingleton().RegisterFactory(TplDuiWindowFactory<CDuiButtonEx>());
  DuiWindowFactoryManager::getSingleton().RegisterFactory(TplDuiWindowFactory<CDui3DView>());
  DuiWindowFactoryManager::getSingleton().RegisterFactory(TplDuiWindowFactory<CEmbedEdit>());
  DuiWindowFactoryManager::getSingleton().RegisterFactory(TplDuiWindowFactory<CEmbedButton>());
	int nRet = 0; 
	// BLOCK: Run application
	{
		CLoginDlg dlgLogin;  
		nRet = dlgLogin.DoModal();  
	}

	duiSystem.logEvent(_T("demo end"));

	delete duiSystem.GetResProvider();

	CoUninitialize();
	return nRet;
}
コード例 #5
0
ファイル: DiskfltInst.cpp プロジェクト: amxku/diskfilter
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_COOL_CLASSES | ICC_BAR_CLASSES);	// add flags to support other controls

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

	_isSysInstall = isServiceRunning(SERVICE_NAME);

	int nRet = EXIT_SUCCESS;
	if (_isSysInstall)
	{
		while (1)
		{
			CLoginDlg	dlg;
			if (IDOK == dlg.DoModal(NULL))
			{
				if (login(dlg.m_passWord.GetBuffer(0)))
				{
					lstrcpy(_passWord, dlg.m_passWord.GetBuffer(0));
					Run(lpstrCmdLine, nCmdShow);
					break;
				}
				else
				{
					MessageBox(NULL, _T("ÃÜÂë´íÎó£¬ÇëÖØÐÂÊäÈëÃÜÂë!"), _T("´íÎó"), MB_OK | MB_ICONERROR);
				}
			}
			else
			{
				break;
			}
		}

	}
	else
	{
		nRet = Run(lpstrCmdLine, nCmdShow);
	}

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

	return nRet;
}
コード例 #6
0
ファイル: test5-1.cpp プロジェクト: runninglzw/MFC
BOOL Ctest51App::InitInstance()
{
	CWinApp::InitInstance();


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

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

	// 标准初始化
	// 如果未使用这些功能并希望减小
	// 最终可执行文件的大小,则应移除下列
	// 不需要的特定初始化例程
	// 更改用于存储设置的注册表项
	// TODO: 应适当修改该字符串,
	// 例如修改为公司或组织名
	SetRegistryKey(_T("应用程序向导生成的本地应用程序"));
	CLoginDlg login;
	if(IDCANCEL==login.DoModal())
		return FALSE;
	Ctest51Dlg 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;
}
コード例 #7
0
BOOL CTXAPIToolApp::InitInstance()
{
	// 如果一个运行在 Windows XP 上的应用程序清单指定要
	// 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
	//则需要 InitCommonControlsEx()。否则,将无法创建窗口。
	INITCOMMONCONTROLSEX InitCtrls;
	InitCtrls.dwSize = sizeof(InitCtrls);
	// 将它设置为包括所有要在应用程序中使用的
	// 公共控件类。
	InitCtrls.dwICC = ICC_WIN95_CLASSES;
	InitCommonControlsEx(&InitCtrls);

	CWinApp::InitInstance();

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

	CLoginDlg loginDlg;
    CTXAPIToolDlg dlg;
	
	if(loginDlg.DoModal() == IDOK)
	{
		m_pMainWnd = &dlg;
		dlg.m_strAppKey = loginDlg.m_sstrAppKey;
		dlg.m_strAppSecret = loginDlg.m_sstrAppSecret;
		dlg.m_strAccessKey = loginDlg.m_sstrAccessKey;
		dlg.m_strAccessSecret = loginDlg.m_sstrAccessSecret;

		INT_PTR nResponse = dlg.DoModal();
		if (nResponse == IDOK)
		{
			// TODO: 在此处放置处理何时用“确定”来关闭
			//  对话框的代码
		}
		else if (nResponse == IDCANCEL)
		{
			// TODO: 在此放置处理何时用“取消”来关闭
			//  对话框的代码
		}

		// 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序,
		//  而不是启动应用程序的消息泵。
	}
	return FALSE;
}
コード例 #8
0
ファイル: V5.cpp プロジェクト: gdc-sure/PMS
BOOL CV5App::InitInstance()
{
	// 如果一个运行在 Windows XP 上的应用程序清单指定要
	// 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
	//则需要 InitCommonControlsEx()。否则,将无法创建窗口。
	INITCOMMONCONTROLSEX InitCtrls;
	InitCtrls.dwSize = sizeof(InitCtrls);
	// 将它设置为包括所有要在应用程序中使用的
	// 公共控件类。
	InitCtrls.dwICC = ICC_WIN95_CLASSES;
	InitCommonControlsEx(&InitCtrls);

	CWinApp::InitInstance();

	AfxEnableControlContainer();

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

	CLoginDlg dlg;
	//m_pMainWnd = &dlg;
	//INT_PTR nResponse = dlg.DoModal();
	//if (nResponse == IDOK)
	if(dlg.DoModal()==IDOK)
	{
		// TODO: 在此放置处理何时用
		//  “确定”来关闭对话框的代码
		CV5Dlg  *pMainDlg=new CV5Dlg;
		m_pMainWnd=pMainDlg;
		pMainDlg->DoModal();
		delete pMainDlg;
		pMainDlg=NULL;
	    //dlg.DoModal();
	}
	else
	{
		// TODO: 在此放置处理何时用
		//  “取消”来关闭对话框的代码
	}

	// 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序,
	//  而不是启动应用程序的消息泵。
	return FALSE;
}
コード例 #9
0
//=--------------------------------------------------------------------------=
// CImp_DrawDlg::LoginPrompt
//=--------------------------------------------------------------------------=
// Purpose: This function pops up a logon dialog box and returns the name given.
//  
//
// Parameters:
//    CString	-	This name will be given as a default name in the dialog box.
//
// Output:
//    CString	-	This is the name given by the user.
//
// 
CString CImp_DrawDlg::LoginPrompt(CString DefaultName)
{
	CLoginDlg	dialog;
	dialog.m_strLogin = DefaultName;
	UINT uId = dialog.DoModal();
    if (uId ==IDCANCEL)
    {
        //
        // exit
        //
        OnCancel();
    }
	return dialog.m_strLogin;
};
コード例 #10
0
BOOL fsInternetFileListMgr::AskForLogin(LPCSTR pszHostName)
{
	CLoginDlg dlg;

	dlg.m_strServer = pszHostName;
	dlg.m_strUser = m_strUser;
	dlg.m_strPassword = m_strPassword;

	if (IDCANCEL == dlg.DoModal ())
		return FALSE;

	m_strUser = dlg.m_strUser;
	m_strPassword = dlg.m_strPassword;

	return TRUE;
}
コード例 #11
0
ファイル: DisDraw.Cpp プロジェクト: nizihabi/sdk71examples
BOOL CDisdrawApp::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
#else
	Enable3dControlsStatic();	// Call this when linking to MFC statically
#endif

	//
	// Prompt for the user's name
	//
	char mbsUserName[MAX_USERNAME_LEN];
	DWORD dwNumBytes = MAX_USERNAME_LEN;
	GetUserName(mbsUserName, &dwNumBytes);
	CLoginDlg dlgLogin;
	dlgLogin.m_strLogin = mbsUserName;
	if (dlgLogin.DoModal() == IDCANCEL || dlgLogin.m_strLogin == "" )
	{
		return FALSE;
	}

	dlgLogin.m_strLogin.MakeUpper();

	CDisdrawDlg dlg;
	m_pMainWnd = &dlg;
	dlg.m_strLogin = dlgLogin.m_strLogin;
	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
	}

	// Since the dialog has been closed, return FALSE so that we exit the
	//  application, rather than start the application's message pump.
	return FALSE;
}
コード例 #12
0
ファイル: ticklerexe.cpp プロジェクト: huilang22/Projects
BOOL CTicklerexeApp::InitInstance()
{
	////////////////////////////////////////////////////////////////////////////
	// RSR Below is code copied from EFTEXE
	////////////////////////////////////////////////////////////////////////////
	CHidden			*TicklerDlg;
	CSystemData		*SystemData;
	HINSTANCE		hGal;
	BOOL			bFreed;
	CLoginDlg		Ldlg;

        InitArborLocale();

	// Had troubles creating dialog without this,so thought I'd try it.
	AfxEnableControlContainer();

	if (! (hGal = LoadLibrary("gal.dll")))
	{
		CGuiMsg::GuiMessage( GUIMSG_GAL_DLL_LOAD_FAILED);
		return FALSE;
	}

	SystemData = new CSystemData (TRUE, TRUE );

	Enable3dControls();

	//-----gmf 24.03.00-----------------------------------------------------
	if (m_hticklerResources)
        	::FreeLibrary(m_hticklerResources);

    /* Look for a resource-only dll, regardless of language.
     */
   
    m_hticklerResources = CArbResourceDLL::LoadResLibrary(_T("tickler_res.dll"));
	
    if (! m_hticklerResources)
	{
		AfxMessageBox(_T("Could not load application resource DLL.  Exiting..."));
		return FALSE;
	}

	AfxSetResourceHandle(m_hticklerResources);
   CArborApp::InitInstance();

	//----------------------------------------------------------

	LoadStdProfileSettings();  // Load standard INI file options (including MRU)

	//
    // verify user to login is valid
    //
	CArborCommandLineInfo cmdInfo;
	ParseCommandLine(cmdInfo);

  if ( Ldlg.LoginToCatalog( *SystemData, FALSE, &cmdInfo ) != ABP_SUCCESS )
	{
	   bFreed = FreeLibrary( hGal );
	   if( !bFreed )
	   {
		   DWORD dLastError;
		   char szErrorMsg[ 128 ];
		   dLastError = GetLastError();
		   sprintf( szErrorMsg, "FreeLibrary call to free gal.dll failed!!!\nLast Error: %d", dLastError );
		    GuiError(__FILE__, __LINE__, szErrorMsg );
	   }
		delete SystemData;
		return FALSE;
	   //exit( 1 );
	}

	if ((SystemData->LoginToAdmin()) == FALSE)
	{
		FreeLibrary(hGal);
		delete SystemData;
		return FALSE;
	}

	TicklerDlg = new CHidden(*SystemData, AfxGetMainWnd());
	int nResponse = TicklerDlg->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
	} 

	FreeLibrary(hGal);
	FreeLibrary(m_hticklerResources);

	delete TicklerDlg;
	delete SystemData;

	// Since the dialog has been closed, return FALSE so that we exit the
	// application, rather than start the application's message pump.
	return FALSE;// Logout done in destructor

}
コード例 #13
0
ファイル: groupsexe.cpp プロジェクト: huilang22/Projects
BOOL CGroupsexeApp::InitInstance()
{
	// DLL Handles
	HINSTANCE hGAL;	

	int ReturnValue = ABP_FAILURE;

	// initialize internationalized labels
    InitArborLocale();

	//CSystemData cSystemData( TRUE, TRUE );

	if (! (hGAL = LoadLibrary("gal.dll")))
	{
		CGuiMsg::GuiMessage( GUIMSG_GAL_DLL_LOAD_FAILED);
		return FALSE;
	}

	AfxEnableControlContainer();

	Enable3dControls();			// Call this when using MFC in a shared DLL
  
	// initialize internationalized labels
	//-----gmf 24.03.00-----------------------------------------------------
	if (m_hGroupsResources)
        	::FreeLibrary(m_hGroupsResources);

    /* Look for a resource-only dll for Groups, regardless of language.
     */
   
    m_hGroupsResources = CArbResourceDLL::LoadResLibrary(_T("groupsexe_res.dll"));
	
    if (! m_hGroupsResources)
	{
		AfxMessageBox(_T("Could not load application resource DLL. Exiting..."));
		return FALSE;
	}

	AfxSetResourceHandle(m_hGroupsResources);
   CArborApp::InitInstance();

	//----------------------------------------------------------

	LoadStdProfileSettings();  // Load standard INI file options (including MRU)

	/* display the login dialog */
	CLoginDlg Ldlg;
	// account data that needs passed to the dll...
	/*CAMqa66118*/
	m_lpAccountData = new CAccountData(TRUE, TRUE);
	/* verify user to login is valid */	

	CArborCommandLineInfo cmdInfo;
	ParseCommandLine(cmdInfo);

	if( (ReturnValue = Ldlg.LoginToCatalog( *m_lpAccountData, FALSE, &cmdInfo )) != ABP_SUCCESS )
	{
		DWORD dLastError;
		char szErrorMsg[ 128 ];

		dLastError = GetLastError();
		if( dLastError != 0 )
		{
			sprintf( szErrorMsg, GetIntlString(IDS_LOGIN_CATALOG_FAILED), "%d", dLastError );
		    AfxMessageBox( szErrorMsg );
		}
		DropLibraries( hGAL );
		return FALSE;
	}
	
	//Display Groups Dialog Box.
	CGroupsDlg *lpGroupsDlg;
	lpGroupsDlg = new CGroupsDlg( *m_lpAccountData );

	int nResponse = lpGroupsDlg->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
	}

	// deallocate the memory space taken by the dlg new call
	delete lpGroupsDlg;
	DropLibraries( hGAL );
	FreeLibrary(m_hGroupsResources);

	// Since the dialog has been closed, return FALSE so that we exit the
	//  application, rather than start the application's message pump.
	return FALSE;
}
コード例 #14
0
ファイル: BaikuDemo.cpp プロジェクト: Omgan/code4me
BOOL CBaikuDemoApp::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);

	// Gdiplus initialize:
	GdiplusStartupInput gdiplusStartupInput;
	GdiplusStartup(&m_gdiplusToken, &gdiplusStartupInput, NULL);


	CWinAppEx::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)

	InitContextMenuManager();

	InitKeyboardManager();

	InitTooltipManager();
	CMFCToolTipInfo ttParams;
	ttParams.m_bVislManagerTheme = TRUE;
	theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL,
		RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams);

	TRACE(_T("start load theme here."));
	LoadTheme();

	CLoginDlg dlg;
	dlg.DoModal();
	if (!dlg.IsLogin()) {
		TRACE(_T("Don't login!!!"));
		return FALSE;
	}
	return TRUE;

	// 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(CBaikuDemoDoc),
		RUNTIME_CLASS(CMainFrame),       // main SDI frame window
		RUNTIME_CLASS(CBaikuDemoView));
	if (!pDocTemplate)
		return FALSE;
	AddDocTemplate(pDocTemplate);

	// 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
	return TRUE;
}
コード例 #15
0
BOOL CAlarmCenterApp::InitInstance()
{
	/*{
		bool connect_by_sse_or_ip_ = true;
		std::string cloud_sse_id_ = "";
		std::string device_ipv4_ = "";
		int device_port_ = 0;
		std::wstring user_name_ = L"";
		int user_id = 0;
		std::wstring _device_note = L"";
		int _id = 0;

		CString sql;
		sql.Format(L"update table_device_info_jovision set \
connect_by_sse_or_ip=%d,\
cloud_sse_id='%s',\
device_ipv4='%s',\
device_port=%d,\
user_name='%s',\
user_passwd='%s',\
user_info_id=%d,\
device_note='%s' where id=%d",
connect_by_sse_or_ip_ ? 1 : 0,
utf8::a2w(cloud_sse_id_).c_str(),
utf8::a2w(device_ipv4_).c_str(),
device_port_,
user_name_.c_str(),
user_id,
_device_note.c_str(),
_id);

		JLOG(sql);
	}*/


	do {
		if (IfProcessRunning())
			break;
		auto log = log::get_instance();
		log->set_output_to_dbg_view();
		log->set_line_prifix("HB");
		log->set_log_file_foler(get_exe_path_a() + "\\Log");
		log->set_log_file_prefix("AlarmCenter");
		log->set_output_to_file();
		
		JLOG(L"AlarmCenter startup.\n");
		AUTO_LOG_FUNCTION;

		int	nRet;
		WSAData	wsData;

		nRet = WSAStartup(MAKEWORD(2, 2), &wsData);
		if (nRet < 0) {
			JLOG(L"Can't load winsock.dll.\n");
			break;
		}


#pragma region init crashrpt
		// Place all significant initialization in InitInstance
		// Define CrashRpt configuration parameters
		CR_INSTALL_INFO info;
		memset(&info, 0, sizeof(CR_INSTALL_INFO));
		info.cb = sizeof(CR_INSTALL_INFO);
		info.pszAppName = _T("AlarmCenter");
		static CString version;
		detail::GetProductVersion(version);
		info.pszAppVersion = version;
		info.pszEmailSubject = _T("AlarmCenter Error Report");
		info.pszEmailTo = _T("*****@*****.**");
		info.pszUrl = _T("http://113.140.30.118/crashrpt.php");
		info.uPriorities[CR_HTTP] = 3;  // First try send report over HTTP 
		info.uPriorities[CR_SMTP] = 2;  // Second try send report over SMTP  
		info.uPriorities[CR_SMAPI] = 1; // Third try send report over Simple MAPI    
										// Install all available exception handlers
		info.dwFlags |= CR_INST_ALL_POSSIBLE_HANDLERS;
		// Restart the app on crash 
		info.dwFlags |= CR_INST_APP_RESTART;
		info.dwFlags |= CR_INST_SEND_QUEUED_REPORTS;
		//info.pszRestartCmdLine = _T("/restart");
		// Define the Privacy Policy URL 
		//info.pszPrivacyPolicyURL = _T("http://myapp.com/privacypolicy.html");

		// Install crash reporting
		int nResult = crInstall(&info);
		if (nResult != 0) {
			// Something goes wrong. Get error message.
			TCHAR szErrorMsg[512] = _T("");
			crGetLastErrorMsg(szErrorMsg, 512);
			_tprintf_s(_T("%s\n"), szErrorMsg);
			MessageBox(nullptr, szErrorMsg, L"Error", MB_ICONERROR);
			break;
		}

		// Set crash callback function
		//crSetCrashCallback(CrashCallback, nullptr);

		// Add our log file to the error report
		crAddFile2(utf8::a2w(log::get_instance()->get_log_file_path()).c_str(), nullptr, _T("Log File"), CR_AF_MAKE_FILE_COPY);

		// We want the screenshot of the entire desktop is to be added on crash
		crAddScreenshot2(CR_AS_VIRTUAL_SCREEN, 0);

		// Add a named property that means what graphics adapter is
		// installed on user's machine
		//crAddProperty(_T("VideoCard"), _T("nVidia GeForce 8600 GTS"));



#pragma endregion

		auto res = res::get_instance();
		auto cfg = util::CConfigHelper::get_instance();
		auto lang = cfg->get_language();
		auto path = get_exe_path();
#ifdef _DEBUG
		path = path.substr(0, path.find_last_of(L'\\'));
		path += L"\\installer";
#endif
		switch (lang) {	
		case util::AL_TAIWANESE:
			res->parse_file(path + L"\\lang\\zh-tw.txt");
			SetThreadUILanguage(MAKELCID(MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL), SORT_DEFAULT));
			break;
		case util::AL_ENGLISH:
			res->parse_file(path + L"\\lang\\en-us.txt");
			SetThreadUILanguage(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT));
			break;
		case util::AL_CHINESE:
		default:
			res->parse_file(path + L"\\lang\\zh-cn.txt");
			SetThreadUILanguage(MAKELCID(MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED), SORT_DEFAULT));
			break;
		}

		CAppResource::get_instance();

		// 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.
		auto pShellManager = std::make_unique<CShellManager>();

		// Activate "Windows Native" visual manager for enabling themes in MFC controls
		//CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));

		// 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
		// You should modify this string to be something appropriate
		// such as the name of your company or organization
		SetRegistryKey(_T("Local AppWizard-Generated Applications"));

		CLoginDlg loginDlg;
		if (loginDlg.DoModal() != IDOK) {
			JLOG(L"user canceled login.\n");
			break;
		}

		CSetupNetworkDlg setupDlg;
		if (setupDlg.DoModal() != IDOK) {
			JLOG(L"user canceled setup network.\n");
			break;
		}

		CAlarmCenterDlg dlg;
		m_pMainWnd = &dlg;
		INT_PTR nResponse = dlg.DoModal();
		if (nResponse == IDOK) {

		} else if (nResponse == IDCANCEL) {

		} else if (nResponse == -1) {
			TRACE(L"Warning: dialog creation failed, so application is terminating unexpectedly.\n");
			TRACE(L"Warning: if you are using MFC controls on the dialog, you cannot #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS.\n");
		}

		

	} while (false);

	
	//video::ezviz::sdk_mgr_ezviz::release_singleton();
	

	// Since the dialog has been closed, return FALSE so that we exit the
	//  application, rather than start the application's message pump.
	return FALSE;
}
コード例 #16
0
ファイル: ATrade.cpp プロジェクト: Randy090807/Github
BOOL CATradeApp::InitInstance()
{
	// 如果一个运行在 Windows XP 上的应用程序清单指定要
	// 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
	//则需要 InitCommonControlsEx()。  否则,将无法创建窗口。
	INITCOMMONCONTROLSEX InitCtrls;
	InitCtrls.dwSize = sizeof(InitCtrls);
	// 将它设置为包括所有要在应用程序中使用的
	// 公共控件类。
	InitCtrls.dwICC = ICC_WIN95_CLASSES;
	InitCommonControlsEx(&InitCtrls);

	CWinAppEx::InitInstance();

	AfxSocketInit();

	// 初始化 OLE 库
	if (!AfxOleInit())
	{
		AfxMessageBox(IDP_OLE_INIT_FAILED);
		return FALSE;
	}

	AfxEnableControlContainer();

	EnableTaskbarInteraction();

	// 使用 RichEdit 控件需要  AfxInitRichEdit2()	
	// AfxInitRichEdit2();

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

	GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);

	// 初始化配置信息
	CConfig::Inst();


	CLoginDlg dlg;
	if ( dlg.DoModal() != IDOK)
	{
		return 0;
	}

	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_ATradeTYPE,
// 		RUNTIME_CLASS(CATradeDoc),
// 		RUNTIME_CLASS(CChildFrame), // 自定义 MDI 子框架
// 		RUNTIME_CLASS(CATradeView));
// 	if (!pDocTemplate)
// 		return FALSE;
// 	AddDocTemplate(pDocTemplate);

	

	CMainDlg mainDlg;
	mainDlg.DoModal();

	// 创建主 MDI 框架窗口
// 	CMainFrame* pMainFrame = new CMainFrame;
// 	if (!pMainFrame || !pMainFrame->LoadFrame(IDR_MAINFRAME))
// 	{
// 		delete pMainFrame;
// 		return FALSE;
// 	}
// 	m_pMainWnd = pMainFrame;


	// 分析标准 shell 命令、DDE、打开文件操作的命令行
// 	CCommandLineInfo cmdInfo;
// 	ParseCommandLine(cmdInfo);
// 
// 
// 
// 	// 调度在命令行中指定的命令。  如果
// 	// 用 /RegServer、/Register、/Unregserver 或 /Unregister 启动应用程序,则返回 FALSE。
// 	if (!ProcessShellCommand(cmdInfo))
// 		return FALSE;
	// 主窗口已初始化,因此显示它并对其进行更新
// 	pMainFrame->ShowWindow(m_nCmdShow);
// 	pMainFrame->UpdateWindow();

	return TRUE;
}
コード例 #17
0
ファイル: PulseDisplayDlg.cpp プロジェクト: enildne/zest
BOOL CPulseDisplayDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// 이 대화 상자의 아이콘을 설정합니다. 응용 프로그램의 주 창이 대화 상자가 아닐 경우에는
	// 프레임워크가 이 작업을 자동으로 수행합니다.
	SetIcon(m_hIcon, TRUE);			// 큰 아이콘을 설정합니다.
	SetIcon(m_hIcon, FALSE);		// 작은 아이콘을 설정합니다.

	// 로그인 화면 구성 필요.
#ifdef LOGIN_DLG
	CLoginDlg	loginDlg;
	BOOL		noLogin = FALSE;
	while(loginDlg.DoModal() != IDOK)
	{
		if(AfxMessageBox(INVALID_USER, MB_OKCANCEL, NULL) == IDOK)
		{
			noLogin = TRUE;
			break;
		}
	}
	
	if(noLogin)
	{
		::PostQuitMessage(WM_QUIT);
		return FALSE;
	}
	else
		m_UserName = loginDlg.getUserName();

	// 로그인 화면 종료
#endif

#ifndef LIMIT_SCREEN_SIZE
	int cx = GetSystemMetrics(SM_CXSCREEN);
	int cy = GetSystemMetrics(SM_CYSCREEN);

	this->SetWindowPos(&CWnd::wndNoTopMost, 0, 0, cx, cy, SWP_NOMOVE);
#else
	this->SetWindowPos(&CWnd::wndNoTopMost, 0, 0, MAIN_DLG_WIDTH, MAIN_DLG_HEIGHT, SWP_NOMOVE);
#endif

	this->SetWindowText(MAIN_WINDOW_NAME);

	SetTimer(TID_TIME, 1000, NULL);

	m_ctlTabMain.InsertItem(0, _T(TAB1_DSP_NAME));
	m_ctlTabMain.InsertItem(1, _T(TAB2_DSP_NAME));
	m_ctlTabMain.InsertItem(2, _T(TAB3_DSP_NAME));
	m_ctlTabMain.InsertItem(3, _T(TAB4_DSP_NAME));
#ifndef LIMIT_SCREEN_SIZE
	m_ctlTabMain.SetItemSize(CSize(cy / 4 - 5));
#else
	m_ctlTabMain.SetItemSize(CSize(MAIN_DLG_WIDTH / 4 - 5));
#endif

	m_modelName.Empty();				// 모델이름 초기화

	SetTAB1Disp();
	SetLogFile();

	return TRUE;  // 컨트롤에 대한 포커스를 설정하지 않을 경우 TRUE를 반환합니다.
}
コード例 #18
0
ファイル: Library.cpp プロジェクト: zerxon/library
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;
}
コード例 #19
0
ファイル: bibexe.cpp プロジェクト: huilang22/Projects
BOOL CBibexeApp::InitInstance()
{
	/* display the login dialog */
	CLoginDlg Ldlg;
	CBibDlg  *lpdlg;

        InitArborLocale();

	if (! (m_hGAL = LoadLibrary("gal.dll")))
	{
		CGuiMsg::GuiMessage( GUIMSG_GAL_DLL_LOAD_FAILED);
		return FALSE;
	}
	
	// initialize internationalized labels
	//-----gmf 24.03.00-----------------------------------------------------
	if (m_hbibResources)
        	::FreeLibrary(m_hbibResources);

    /* Look for a resource-only dll, regardless of language.
     */
   
    m_hbibResources = CArbResourceDLL::LoadResLibrary(_T("bibexe_res.dll"));
	
    if (! m_hbibResources)
	{
		AfxMessageBox(_T("Could not load application resource DLL.  Exiting..."));
		return FALSE;
	}

	AfxSetResourceHandle(m_hbibResources);
   CArborApp::InitInstance();

	//----------------------------------------------------------

 	Enable3dControls();

  CAccountData AccountData(TRUE, TRUE);

	//
	// Log in to the catalog database.
	//
	CArborCommandLineInfo cmdInfo;
	ParseCommandLine(cmdInfo);

	if( Ldlg.LoginToCatalog( AccountData, FALSE, &cmdInfo ) != ABP_SUCCESS )
		return FALSE;  // Logout done in destructor
	if (AccountData.LoginToAdmin() == FALSE)
		return FALSE;  // Logout done in destructor

	/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Requires the securitytypes.h (or securityclass.h)
	/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//	if(!AccountData.m_lpSecurity->IsAllowed(SECURITY_BIB))
//	{
//		CGuiMsg::GuiMessage( GUIMSG_BIB_ACCESS_DENIED );
//		return FALSE; 
//	}


  LoadStdProfileSettings();  // Load standard INI file options (including MRU)

	lpdlg = new CBibDlg ( AccountData );

	m_pMainWnd =  lpdlg;

	int nResponse = lpdlg->DoModal();
	delete lpdlg;
	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
	}

	AccountData.Logout();

	// Since the dialog has been closed, return FALSE so that we exit the
	//  application, rather than start the application's message pump.
	return FALSE;
}
コード例 #20
0
ファイル: MainFrm.cpp プロジェクト: SamNiBoy/DGG
void CMainFrame::OnMenuLogin() 
{
	// TODO: Add your command handler code here
	CLoginDlg dlg;
	while(dlg.DoModal() == IDOK && dlg.m_bSuccess == FALSE);	
}