Re: Associate Dialog Resource With Class
On Mar 24, 1:06 am, Joseph M. Newcomer <newco...@flounder.com> wrote:
See my essay on deriving classes from dialog classes. The bottom line =
is the IDD
declaration is irrelevant except for the class that needs to instantiate =
the template.
That is true, but the question was how to make IDE connect the dots.
What I said is true, at least for simple dialog class, in 2008 SP1, I
just tried. I wrote this in a random *.cpp of some test project:
class CC : public CDialog
{
enum { IDD=IDD_DODO };
};
Then I went into resource editor and added a dialog resource named
IDD_DODO. I put a random checkbox on it, and double-clicked. That gave
me this:
class CC : public CDialog
{
enum { IDD=IDD_DODO };
public:
DECLARE_MESSAGE_MAP()
afx_msg void OnBnClickedCheck1();
};
and this:
BEGIN_MESSAGE_MAP(CC, CDialog)
ON_BN_CLICKED(IDC_CHECK1, &CC::OnBnClickedCheck1)
END_MESSAGE_MAP()
void CC::OnBnClickedCheck1()
{
// TODO: Add your control notification handler code here
}
Sure, I have seen that code generation in IDE fails, and to be frank,
when that happens, I simply shrug and do stuff by hand. But MS guys
__are__ working on it. Give credit where credit's due.
Goran.