Re: Visual C++: the need for MFC
jacob navia wrote:
I always use C for my dialogs. Suppose a dialog that asks for a number,
with two OK Cancel buttons.
The minimal code to handle that dialog is:
INT_PTR CALLBACK AskALine(HWND hDlg,MSGTYPE message,WPARAM wParam,LPARAM
lParam)
{
int i, c, line;
HWND hCB;
char tmpbuf[10];
switch (message) {
case WM_COMMAND:
switch (GETIDFROMWPARAM(wParam)) {
case IDOK:
GetDlgItemText(hDlg,IDGOTOLINENR, tmpbuf, 9);
if (!ValidateInteger(tmpbuf, &line))
return 1;
if (l <= 0)
break;
EndDialog(hDlg,line);
return 1;
}
}
return (HandleDefaultMessages(hDlg, message, wParam, lParam));
}
I fail to see where is it that you define the actual contents of the
dialog: Title bar text, dialog text and its location, a textfield (or
similar, to ask for the number) and its geometry, the amount and
contents of the buttons...
The only thing I see there is a callback function which handles
signals received by something.
Note that we are talking about Visual Studio Express here: AFAIK it
doesn't have fancy graphical window design editors. If you want to
create a new window type using the Win32 API, you'll have to write it
completely by hand. And, AFAIK, this is a real nightmare.