I am asking how to make a window application without main window (based only on dialogs)...?
Printable View
I am asking how to make a window application without main window (based only on dialogs)...?
Be more specific on what you want. Do you want to make a dialog box from a resource file, or what? What is your program trying to do? Tell me more and I may be able to help you.
OK.
I don't want to have the main window, because it's too complicated to create all windows (buttons, listbox, etc.) and I want to use a dialog for main window (created in resource file and using own WindowProcedure).
My program will be for entering some data in MySQL database.
Code:#include <windows.h>
HWND g_hwnd;
BOOL CALLBACK DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
/**
* Main entry point
*/
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
DialogBoxParam(NULL, MAKEINTRESOURCE(IDD_DIALOG_MAIN), NULL, DlgProc, 0);
return 0;
}
/**
* Dialog procedure for the main dialog box.
*/
BOOL CALLBACK DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_INITDIALOG:
g_hwnd = hwndDlg;
return TRUE;
case WM_CLOSE:
EndDialog(g_hwnd,0);
return true;
}
return FALSE;
}
and then I don't need WindowProcedure (LRESULT CALLBACK) function?
You still need a window procedure. In my example, the window procedure is the DlgProc function.
Yeah - i was using Dialog functions before, but I didn't remember!
Thanks for all help!