-
DialogBox Message loop?
I'm making a simple file transfer program to learn winsock, however I have one question. My WinMain function is two lines long. My DlgProc function is big.
Do I need a message loop?
Code:
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR lpCmdLine, int ShowCmd)
{
DialogBox(hInstance, MAKEINTRESOURCE(IDD_MainDlg), NULL, (DLGPROC)DialogProc);
MessageBox(NULL, "Hi", "", MB_OK);
return 0;
}
Note: That messagebox is just for testing. it doesn't come up until you close the program (even then you don't see it but you hear the 'ding' sound). That leads me to believe I need no message loop?
survey says?
spoon_
-
You do not need a message loop because you are not registering a window class and creating a window. You are using a dialog box. You do need a dialog box procedure, but what you have looks fine for WinMain.
- Sean
-
I think it is more because DialogBox() creates a modal dialog that does not return until closed (EndDialog() is called).
If you use CreateWindow() (or the Ex) or CreateDialog() and create a modeless window or dialog then you need a msg loop.
If using sockets on windows for file transfer I would recomend using WSA and socket msg's. (Which require a loop)