MFC CDialog not showing
Posted
by
Jesus_21
on Stack Overflow
See other posts from Stack Overflow
or by Jesus_21
Published on 2012-06-28T15:03:42Z
Indexed on
2012/06/28
15:16 UTC
Read the original article
Hit count: 280
here is my problem : In my Solution, I have 2 projects, one is a lib in which I created a ressource file (mylib.rc) and a dialog template in it. Then I made a class which inherits CDialog and uses this template. But when I instantiate it and call DoModal(), nothing appends...
here the code of my class, is something wrong with it ?
MyDialog.h
/*MyDialog.h*/
#pragma once
#include "../../../resource.h"
class MyDialog : public CDialog
{
enum {IDD=IDD_DLGTEMPLATE};
public:
MyDialog(CWnd* pParent = NULL);
virtual ~MyDialog();
protected:
virtual BOOL OnInitDialog();
DECLARE_MESSAGE_MAP()
private:
afx_msg void OnBnClickedOk();
afx_msg void OnBnClickedCancel();
};
MyDialog.cpp
/*MyDialog.cpp*/
#include "stdafx.h"
#include "MyDialog.h"
MyDialog::MyDialog(CWnd* pParent /*=NULL*/) : CDialog(IDD_DLGTEMPLATE, pParent) {}
MyDialog::~MyDialog() {}
BOOL MyDialog::OnInitDialog() { return TRUE; }
BEGIN_MESSAGE_MAP(MyDialog, CDialog)
ON_BN_CLICKED(IDOK, &MyDialog::OnBnClickedOk)
ON_BN_CLICKED(IDCANCEL, &MyDialog::OnBnClickedCancel)
END_MESSAGE_MAP()
void MyDialog::OnBnClickedOk() { OnOK(); }
void MyDialog::OnBnClickedCancel() { OnCancel(); }
© Stack Overflow or respective owner