http://winprog.org/tutorials
Read the stuff on dialogs there and MSND should seem like heaven.
And as to your first question, there are two main ways to use a dialog as your main window. The first is as follows.
Code:
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdShow, int nCmdShow)
{
return DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(dialog ID), NULL, dialog's procedure);
}
Very basic. As soon as your dialog closes, out application ends. personally, I prefer the other way, since I have had problems with giving the program an icon using this method. The other is this.
Code:
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdShow, int nCmdShow)
{
MSG Msg;
DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(dialog ID), NULL, dialog's procedure);
while(GetMessage(&Msg, NULL, 0, 0))
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
return Msg.wParam;
}
My guess is that you are using this method, but not doing this next step. You MUST have this next case in your Dialog's procedure.
Code:
case WM_CLOSE:
{
EndDialog(hwnd, 0);
PostQuitMessage(0);
}
break;
It's the PostQuitMessage line that actually ends your entire program. Without this, your dialog closes, but your program is still running, doing nothing. In fact, if you are using Windows XP, you can press Ctrl+Alt+Delete and click on the Processes tab and you'll be able to find your program listed there. You can end it from there, but otherwise, it will keep on running until it recieves a QuitMessage, which will never happen if you don't put it in your code.