首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏全栈程序员必看

    CWnd的派生类-3、CDialog

    只需要一个以模板为实参的创建命令,如CDialog::Create(),就可以完成对话框窗口及其子控件的创建工作,所有创建细节都由对话框模板来指示。 下面是对CDialog::DoModal()函数的简单缩写。 int CDialog::DoModal() {  //装入对话框模板资源 HINSTANCE hInst = AfxGetResourceHandle(); hDialogTemplate = 下面列出相关的几个成员函数: void CDialog::OnOK() { if (! 但如果使用CDialog::Create()创建了一个非模态对话框,就不得不在直接或间接调用EndDialog()关闭对话框后,亲自调用DestroyWindow()了。

    2K30编辑于 2022-07-05
  • 来自专栏jiajia_deng

    mfc 创建模态对话框与非模态对话框

    1、在资源视图中创建一个对话框资源 2、给该对话框资源创建一个类,继承于 CDialog 类,命名为 CMyDialog 图片 3、在想创建该对话框的地方添加如下代码   // 模态对话框 创建非模态对话框 创建非模态对话框相对简单,我们可以不需要自己派生一个 CDialog 的子类再调用子类的 DoModal(这个函数是模态对话框使用的),如果我们已经在资源视图创建好了对话框资源,那么直接使用如下代码就可以创建一个非模态的对话框 // 非模态 CDialog* dialog = new CDialog;// new 一个对话框对象 dialog->Create(IDD_MYDIALOG, this);// 初始化对话框和我们的对话框资源绑定

    1.3K10编辑于 2023-10-20
  • 来自专栏全栈程序员必看

    关闭对话框,OnClose和OnCancel

    :OnCancel() { // TODO: Add your specialized code here and/or call the base class //CDialog OnClose() { // TODO: Add your message handler code here and/or call default CDialog ::OnCancel(); //add OnCancel here CDialog::OnClose(); } : Add your message handler code here and/or call default EndDialog(IDCANCEL); CDialog 自己跟了一下代码,大致梳理了一下流程: WM_CLOSE -> 进入void CXXXXDlg::OnClose() -> CDialog::OnClose(

    1.5K10编辑于 2022-07-12
  • 来自专栏xingoo, 一个梦想做发明家的程序员

    DoModal 函数的用法

    创建有模式对话框的方法是调用CDialog::DoModal()。 下面的代码演示了这种用法: CYourView::OnOpenDlg() { CYourDlg dlg; int iRet=dlg.DoModal(); } CDialog::DoModal 同样的在你的对话框类中为了向调用者返回不同的值可以调用CDialog::OnOK()或是CDialog::OnCancel()以返回IDOK或IDCANCEL,如果你希望返回其他的值,你需要调用 CDialog ::EndDialog( int nResult ); 其中nResult会作为DoModal()调用的返回值 virtual INT_PTR CDialog::DoModal(); 当dlg.DoModal

    2.2K90发布于 2018-01-17
  • 【MFC/C++ MFC中的消息映射机制】

    class CMyDialog : public CDialog { public: CMyDialog(CWnd* pParent = nullptr); protected: // BEGIN_MESSAGE_MAP(CMyDialog, CDialog) ON_BN_CLICKED(IDC_BUTTON1, &CMyDialog::OnButtonClicked) // 示例场景 // MyDialog.h class CMyDialog : public CDialog { DECLARE_MESSAGE_MAP() afx_msg void OnBtnTest (); // 处理函数 }; // MyDialog.cpp BEGIN_MESSAGE_MAP(CMyDialog, CDialog) ON_BN_CLICKED(IDC_BTN_TEST,

    9910编辑于 2026-01-23
  • 来自专栏bit哲学院

    【大三操作系统实验】 请求页式管理中的置换算法

    int *count_0,int num);    int OPT(int *count_0,int i,int num,int *vis);    class CAboutDlg : public CDialog         //}}AFX_DATA_INIT    }       void CAboutDlg::DoDataExchange(CDataExchange* pDX)    {        CDialog         //{{AFX_DATA_MAP(CAboutDlg)        //}}AFX_DATA_MAP    }       BEGIN_MESSAGE_MAP(CAboutDlg, CDialog END_MESSAGE_MAP()       /    // CMyDlg dialog       CMyDlg::CMyDlg(CWnd* pParent /*=NULL*/)        : CDialog ()->LoadIcon(IDR_MAINFRAME);    }       void CMyDlg::DoDataExchange(CDataExchange* pDX)    {        CDialog

    73130发布于 2020-12-29
  • 来自专栏米扑专栏

    VC++6.0中改变窗口背景颜色和控件背景颜色,CDC,我的感觉

    m_hIcon);               AfxMessageBox("dd");   //写在这儿不弹出        }        else        {               CDialog device context for painting        // TODO: Add your message handler code here        // Do not call CDialog 50,50,80,80,100,100,200,200);        // TODO: Add your message handler code here        // Do not call CDialog

    4.8K30发布于 2019-02-19
  • 来自专栏全栈程序员必看

    MFC控件 — 进度条【案例】「建议收藏」

    ,并为进度条添加一个控件变量 进度条变量:m_Progress 2.在初始化函数中对进度条进行初始化,代码如下: BOOL CSpinDlg::OnInitDialog() { CDialog ; str.Format("%d",nPos); GetDlgItem(IDC_EDIT_Progress)->SetWindowText(str + _T("%"));//显示进度条进度 CDialog

    2K10编辑于 2022-09-13
  • 来自专栏祥的专栏

    [MFC]使用强大的第三方串口类 CSerialPort

    Step3 添加串口响应函数 在我的对话框类中( class CSerialPortTestDlg : public CDialog 在 SerialPortTest.h 头文件中) 添加串口字符接收消息 ******** 然后再在 SerialPortTest.cpp 中进行 WM_COMM_RXCHAR 消息映射: BEGIN_MESSAGE_MAP(CSerialPortTestDlg, CDialog ······ return 0; } Step4 初始化串口 其实就是打开串口和关闭串口 首先 class CSerialPortTestDlg : public CDialog

    5K10发布于 2020-03-10
  • 来自专栏四月天的专栏

    Tcp多人聊天窗口:MFC客户端(2)

    OnBnClickedBtnlog(); //登录按钮响应事件 void LogingMsg();//登录消息发送 构造函数的处理:Tcp连接 LogDlg::LogDlg(CWnd* pParent /*=NULL*/) : CDialog usMsgID,int len,char * RecvBuf); //Tcp消息详细解析 构造函数,析构函数 CwTalkDlg::CwTalkDlg(CWnd* pParent /*=NULL*/) : CDialog m_config.InfoInit(); } void CwTalkDlg::DoDataExchange(CDataExchange* pDX) { KillTimer(UDP_TIMER); CDialog m_UdpNetwork.SocketSendMsg(buf_msg,len); break; case 2: Msg_Pro();//接收消息解析 break; default: break; } CDialog CwTalkDlg::OnClose() { // TODO: Add your message handler code here and/or call default closeflag = true; CDialog

    2.5K20编辑于 2023-03-10
  • 来自专栏流川疯编写程序的艺术

    图像处理代码的一些思考

    将类向导产生的函数做如下修改: HBRUSH CDialogColor::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { HBRUSH hbr = CDialog HBRUSH B = CreateSolidBrush(RGB(125,125,255)); return (HBRUSH) B; } default: return CDialog HBRUSH B = CreateSolidBrush(RGB(125,125,255)); return (HBRUSH) B; } default: return CDialog

    72330发布于 2019-01-18
  • 来自专栏c++ 学习分享

    qt initialized in the dll

    CDialog *g_dialog; BOOL WINAPI DllMain( HINSTANCE hInstance, DWORD dwReason, LPVOID /lpvReserved/ ) showDialog( HWND parent ) { g_win = new QWinWidget( parent ); g_win->showCentered(); g_dialog = new CDialog in step 1 and press on "about" it should load the library "qtdialog.dll" which itself open the child CDialog But then, CDialog is completely unresponsive.

    46520编辑于 2023-07-06
  • 来自专栏图形学与OpenGL

    Avoiding UpdateData(ZZ)

    If you otherwise override OnOK, you can certainly call CDialog::OnOK which implicitly calls UpdateData , since calling CDialog::OnOK eventually invokes the virtual method. correct way to end the dialog is to call EndDialog, usually as EndDialog(IDOK), instead of calling CDialog concern I have is that by calling EndDialog, you are stating that you know that the implementation of CDialog

    59120发布于 2018-10-09
  • 来自专栏全栈程序员必看

    MFC 进度条使用方法[通俗易懂]

    (float)(j-i)*100.0); UpdateData(FALSE); m_pro.StepIt(); } CDialog ::OnTimer(nIDEvent); } 当然在结束程序后应该释放TIMER于是我们有这样的函数: void CProgressinDlg::OnDestroy() { CDialog

    2.8K50编辑于 2022-09-18
  • 来自专栏ClearSeve

    MFC注册热键

    { //....处理热键 return TRUE;//返回这条消息被处理 } } return CDialog

    2.2K20编辑于 2022-02-11
  • 来自专栏米扑专栏

    VC Picture Control显示BMP图片

    VC对话框初始时,Picture Control显示BMP图片: BOOL CLoginDog::OnInitDialog() { CDialog::OnInitDialog();

    1.7K40发布于 2019-02-19
  • 来自专栏测试开发架构之路

    VS2010/MFC编程(对话框:模态对话框及其弹出过程)

    CDialog::DoModal()函数的原型为:        virtual INT_PTR DoModal();           返回值:整数值,指定了传递给CDialog::EndDialog

    3.6K50发布于 2018-04-03
  • 来自专栏米扑专栏

    VC Picture Control 图片点击事件

    OnStnClickedPicViruslist();  afx_msg void OnStnClickedPicSoftlist(); 3、源码.cpp文件添加消息映射 BEGIN_MESSAGE_MAP(Main, CDialog

    1.6K80发布于 2019-02-19
  • 来自专栏全栈程序员必看

    vc编程小经验

    WM_KEYLAST) { if(VK_ESCAPE==pMsg->wParam||VK_RETURN==pMsg->wParam) { return FALSE; } } return CDialog

    1.2K30编辑于 2022-07-02
  • 来自专栏Unity3d程序开发

    MFC对话框最大化时控件放大

    添加 WM_SIZE消息: void CXXX::OnSize(UINT nType, int cx, int cy) { CDialog::OnSize(nType, cx, cy); if

    67430编辑于 2023-08-24
领券