欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

C++基于對(duì)話框的程序的框架實(shí)例

 更新時(shí)間:2014年10月15日 16:41:42   投稿:shichen2014  
這篇文章主要介紹了C++基于對(duì)話框的程序的框架,以實(shí)例形式講述了C++對(duì)話框程序框架,有助于深入理解基于C++的Windows程序設(shè)計(jì),需要的朋友可以參考下

本文實(shí)例講述了C++基于對(duì)話框的程序的框架。分享給大家供大家參考。具體如下:

resource.cpp源文件如下:

復(fù)制代碼 代碼如下:
#include "resource.h" 
 
CMyApp theApp; 
 
BOOL CMyApp::InitInstance() 

    CMainDialog dlg; 
    m_pMainWnd = &dlg;   //給m_pMainWnd 主窗口 
    dlg.DoModal(); 
    return FALSE; //不進(jìn)入消息循環(huán) 

 
 
BEGIN_MESSAGE_MAP(CMainDialog, CDialog) 
ON_BN_CLICKED(IDC_STOP, OnStop) 
ON_MESSAGE(WM_CUTTERSTART, OnCutterStart) //自定義消息 
END_MESSAGE_MAP() 
//CMainDialog 
CMainDialog::CMainDialog(CWnd* pParentWnd):CDialog(IDD_MAIN, pParentWnd) 

 

BOOL CMainDialog::OnInitDialog( ) 

    CDialog::OnInitDialog(); 
    return TRUE; 

void CMainDialog::OnStop() 

    MessageBox("OnStop"); 

long CMainDialog::OnCutterStart(WPARAM wParam, LPARAM lParam)   //處理自定義消息 

    MessageBox("OnCutterStart"); 
    return 0; 
}

resource.h頭文件如下:

復(fù)制代碼 代碼如下:
#include <afxwin.h> 
#define  WM_CUTTERSTART WM_USER+100 
//CMyApp 
class CMyApp:public CWinApp 

public: 
    BOOL InitInstance(); 
}; 
 
//CMyDialog 
class CMainDialog:public CDialog 

public: 
    CMainDialog(CWnd* pParentWnd = NULL); 
 
protected: 
    virtual BOOL OnInitDialog( ); 
    afx_msg void OnStop(); 
    afx_msg long OnCutterStart(WPARAM wParam, LPARAM lParam);  //處理自定義消息的聲明 
 
    DECLARE_MESSAGE_MAP() 
};

希望本文所述對(duì)大家的C++程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論