當前位置:編程學習大全網 - 網站源碼 - 給MFC應用程序加密

給MFC應用程序加密

我想妳說的那個所謂的加密是指的登陸對話框吧,當輸入正確的用戶名和密碼後可以登陸,否則不可以登陸,是這個意思吧。

如果是,妳可以在創建主窗口前先顯示對話框,並設定返回值,如果輸入的用戶名和密碼正確,則返回OK,顯示主窗口。在BOOL COAApp::InitInstance()函數中加入如下代碼:

CLoginDlg login;

if (login.DoModal()==IDOK)

{

CSingleDocTemplate* pDocTemplate;

pDocTemplate = new CSingleDocTemplate(

IDR_MAINFRAME,

RUNTIME_CLASS(COADoc),

RUNTIME_CLASS(CMainFrame), // main SDI frame window

RUNTIME_CLASS(COAView));

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;

// The one and only window has been initialized, so show and update it.

m_pMainWnd->SetWindowText("XXXX系統");

m_pMainWnd->ShowWindow(SW_SHOWMAXIMIZED);

m_pMainWnd->UpdateWindow();

}

  • 上一篇:Java架構師需要掌握哪些技能?有什麽推薦的在線培訓機構嗎?
  • 下一篇:尤美電影院源代碼
  • copyright 2024編程學習大全網