BOOL CTest6App::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 SetRegistryKey(_T("Local AppWizard-Generated Applications")); LoadStdProfileSettings(); // Load standard INI file options (including MRU) int nResponse; CLoginDlg logindlg;//登陆对话框 nResponse = logindlg.DoModal(); if (nResponse == IDOK) { // TODO: Place code here to handle when the dialog is // dismissed with OK } if (nResponse == IDCANCEL) { // TODO: Place code here to handle when the dialog is // dismissed with Cancel return FALSE; } CTest6Dlg dlg; m_pMainWnd = &dlg; 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; }然后重载CLoginDlg对话框的OnOK,在OnOK中添加判断用户名及密码的代码。
还有个办法 nResponse = logindlg.DoModal(); if (nResponse == IDOK) { // TODO: Place code here to handle when the dialog is // dismissed with OK } if (nResponse == IDCANCEL) { // TODO: Place code here to handle when the dialog is // dismissed with Cancel return FALSE; }在nResponse == IDOK下调用一个非模态的对话框 这个对话框你可以设置成自己要的模式 然后 调用 CMyDialog cc cc.create(…………) cc.showwindow(…………) sleep(3000)显示三秒钟,时间可以自己设 然后 cc.destoryWindow(…………)这样的话,那个显示出来的非模态对话框,可以停留三秒 然后销毁,进入下面的主窗口显示hoho 方法自己选好了 用小三的那个启动画面简单点,而且有示例代码了,呵呵~
{
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
SetRegistryKey(_T("Local AppWizard-Generated Applications")); LoadStdProfileSettings(); // Load standard INI file options (including MRU) int nResponse;
CLoginDlg logindlg;//登陆对话框 nResponse = logindlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
return FALSE;
}
CTest6Dlg dlg; m_pMainWnd = &dlg;
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;
}然后重载CLoginDlg对话框的OnOK,在OnOK中添加判断用户名及密码的代码。
http://www.vckbase.com/document/viewdoc/?id=513
http://www.vckbase.com/document/viewdoc/?id=1125
nResponse = logindlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
return FALSE;
}在nResponse == IDOK下调用一个非模态的对话框
这个对话框你可以设置成自己要的模式
然后
调用
CMyDialog cc
cc.create(…………)
cc.showwindow(…………)
sleep(3000)显示三秒钟,时间可以自己设
然后
cc.destoryWindow(…………)这样的话,那个显示出来的非模态对话框,可以停留三秒
然后销毁,进入下面的主窗口显示hoho
方法自己选好了
用小三的那个启动画面简单点,而且有示例代码了,呵呵~