Pure C Dialog Based Application
-
Is it possible to not have a main window as normall proscribed? Basically I would like to use the Dialog builder within Visual Studio to build my "main window." I've tried CreateWindow and CreateDialog all to no avail as they all want parent windows. But unfortunately I want the parent window to be a dialog. Can anyone help me out in this regard? I've read Petzold and have yet to find anything usefull. Sean Cody (NullStream) "As long as you want to live, everywhere will become heaven. Afterall, you are still alive." - End Of Evanglion
-
Is it possible to not have a main window as normall proscribed? Basically I would like to use the Dialog builder within Visual Studio to build my "main window." I've tried CreateWindow and CreateDialog all to no avail as they all want parent windows. But unfortunately I want the parent window to be a dialog. Can anyone help me out in this regard? I've read Petzold and have yet to find anything usefull. Sean Cody (NullStream) "As long as you want to live, everywhere will become heaven. Afterall, you are still alive." - End Of Evanglion
Not entirely sure what you're after, but if you use a style of WS_POPUP you won't need a parent. In fact, specifying this style by itself is the way to get a very minimal window happening.
-
Is it possible to not have a main window as normall proscribed? Basically I would like to use the Dialog builder within Visual Studio to build my "main window." I've tried CreateWindow and CreateDialog all to no avail as they all want parent windows. But unfortunately I want the parent window to be a dialog. Can anyone help me out in this regard? I've read Petzold and have yet to find anything usefull. Sean Cody (NullStream) "As long as you want to live, everywhere will become heaven. Afterall, you are still alive." - End Of Evanglion
Make sure your dialog has the correct properties such as WS_OVERLAPPED. You will need to call RegisterClass before CreateDialog. You'll also need to add IsDialogMessage to your message loop.
dialog.rc:
DialogApp DIALOG DISCARDABLE 0, 0, 416, 229
STYLE WS_OVERLAPPED | WS_MINIMIZEBOX | WS_CAPTION
CLASS "DialogApp"
FONT 8, "Times New Roman"
BEGIN
PUSHBUTTON "Ok",IDOK,214,191,50,14
ENDWinMain():
szAppName = "DialogApp"
WNDCLASS wndclass;
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = WndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = DLGWINDOWEXTRA;
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon (hInstance, szAppName);
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW);
wndclass.hbrBackground = (HBRUSH) (COLOR_BTNFACE+1);
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = szAppName;if (RegisterClass(&wndclass)==0)
{
return 0;
}hwnd = CreateDialog( hInstance, szAppName, 0, NULL);
while (GetMessage(&msg, NULL, 0, 0))
{
if (!IsDialogMessage (hwnd, &msg))
{
TranslateMessage (&msg);
DispatchMessage (&msg);
}
}