時間、介面問題?? |
尚未結案
|
k058456
一般會員 發表:2 回覆:1 積分:0 註冊:2005-03-23 發送簡訊給我 |
|
KENI_LIN
中階會員 發表:86 回覆:267 積分:90 註冊:2004-05-31 發送簡訊給我 |
這是出自VC參考書的程式(VC++6基礎與程式架構篇,李奇編譯,文魁出版),如果你是初學者,建議你參考這本看看;至於怎麼建立功能視窗,我也很難說明,真的看書會比較清楚;以下是它的主要原始code和執行結果,其它物件程式就自己建立看看嘍:
======================================================================
// Clock.cpp : Defines the class behaviors for the application.
// #include "stdafx.h"
#include "Clock.h" #include "MainFrm.h"
#include "ClockDoc.h"
#include "ClockView.h" #ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif /////////////////////////////////////////////////////////////////////////////
// CClockApp BEGIN_MESSAGE_MAP(CClockApp, CWinApp)
//{{AFX_MSG_MAP(CClockApp)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
//}}AFX_MSG_MAP
// Standard file based document commands
ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
END_MESSAGE_MAP() /////////////////////////////////////////////////////////////////////////////
// CClockApp construction CClockApp::CClockApp()
{
} /////////////////////////////////////////////////////////////////////////////
// The one and only CClockApp object CClockApp theApp; /////////////////////////////////////////////////////////////////////////////
// CClockApp initialization BOOL CClockApp::InitInstance()
{
// Standard initialization #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.
SetRegistryKey(_T("Local AppWizard-Generated Applications")); LoadStdProfileSettings(); // Load standard INI file options (including MRU) // Register document templates CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CClockDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CClockView));
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;
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow(); return TRUE;
} /////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About class CAboutDlg : public CDialog
{
public:
CAboutDlg(); // Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA // ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL // Implementation
protected:
//{{AFX_MSG(CAboutDlg)
// No message handlers
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
}; CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
} void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
} BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP() // App command to run the dialog
void CClockApp::OnAppAbout()
{
CAboutDlg aboutDlg;
aboutDlg.DoModal();
} /////////////////////////////////////////////////////////////////////////////
// CClockApp commands
======================================================================
寒窗苦讀十年書;只待今朝狀元時!~~
︵ / / ︵
( ∩ ∩ )
○ ︶ ○
Keni Lin
------
Keni Lin |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |