Posted on 1998-10-06
Here a easy question to you, and a difficult one for me.
In the following code
why they say
the dialog has no attched HWND in the constructor
// create children on InitDialog
// (not in CDerEditDlg constructor since the dialog has
// no attached HWND in the constructor) <------------------here is the question
// This is an example of the _incorrect_ way to create a dialog
// The following code show you what you should _not_ do:
// 1) do not use hard coded numbers for coordinates and sizes
// (these will break when the font sizes changes and are
// hard to edit and maintain).
// 2) do not put strings in code, they should be in resources.
// 3) as you can see below the programming steps required
// to create controls, pass the correct creation parameters,
// and set the appropriate font, is complicated and error prone.
// 4) localization of the controls would require changes to the
// sources for the captions, font, coordinates, and sizes.
const int yStart = 8;
const int height = 30;
CPoint whereLabel(10, yStart);
CSize sizeLabel(80, 24);
CPoint whereEdit(90, yStart);
CSize sizeEdit(140, 24);
m_static1.Create(_T("Letters:"), WS_VISIBLE | WS_CHILD | SS_LEFT,
CRect(whereLabel, sizeLabel), this, (UINT)-1);
whereLabel.y += height;
return FALSE; // focus set