龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > 软件开发 > VC开发 >

VC程序中定制对话框中的回车键(5)

时间:2009-12-30 15:42来源:未知 作者:admin 点击:
分享到:
//////////// frame window class CMainFrame : public CFrameWnd { protected: virtual BOOL PreCreateWindow(CREATESTRUCT cs); public: CMainFrame(); ~CMainFrame(); }; //////////////////// Typical dialog cl

//////////// frame window
class CMainFrame : public CFrameWnd {
protected:
 virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
public:
 CMainFrame();
 ~CMainFrame();
};

//////////////////// Typical dialog
class CMyDlg : public CDlgWithAccelerators {
public:
 CMyDlg(CWnd* pParent = NULL); // standard constructor
protected:
 HICON m_hIcon;
 void NextInTabOrder();
 // MFC overrides
 virtual BOOL OnInitDialog();
 afx_msg void OnMyEnter();
 afx_msg LRESULT OnGetDefID(WPARAM wp, LPARAM lp);
 DECLARE_MESSAGE_MAP()
};

BEGIN_MESSAGE_MAP(CMyApp, CWinApp)
END_MESSAGE_MAP()

CMyApp::CMyApp()
{
 // nothing to do
}

CMyApp::~CMyApp()
{
 // nothing to do
}

//////////////////// InitInstance: create dialog as child
BOOL CMyApp::InitInstance()
{
 // create frame window and load it
 CMainFrame* pFrame = new CMainFrame;
 m_pMainWnd = pFrame;
 pFrame->LoadFrame(IDR_MAINFRAME, WS_OVERLAPPED, NULL, NULL);
 CMyDlg dlg(pFrame); // create dialog and run it
 int nResponse = dlg.DoModal();
 if (nResponse == IDOK)
 {}
 else if (nResponse == IDCANCEL)
 {}
 return FALSE; // quit
}

CMainFrame::CMainFrame()
{
 // nothing to do
}

CMainFrame::~CMainFrame()
{
 // nothing to do
}

///////////// Pre-create window: set WS_EX_TOOLWINDOW style to hide dialog from task bar
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
 if (CFrameWnd::PreCreateWindow(cs)) {
  cs.dwExStyle |= WS_EX_TOOLWINDOW;
  return TRUE;
 }
 return FALSE;
}

收藏文章
表情删除后不可恢复,是否删除
取消
确定
图片正在上传,请稍后...
评论内容为空!
还没有评论,快来抢沙发吧!
按钮 内容不能为空!
立刻说两句吧! 查看0条评论
精彩图集

赞助商链接