Resourceless Dialogbox
-
Help wanted! I need to create a resourceless dialog box. I want it to use a WndProc instead if a DlgProc, and I want to use CreateWindow instead of CreateDialog or variants. Is there a standard window class which I can use to accomplish this task? I was thinking of:
CreateWindow(TEXT("DIALOG"), TEXT("HELLO"), WS_VISIBLE, ...)
^^^^^^
The window classThanks in advance LPCTSTR Dutch = TEXT("Double Dutch :-)");
-
Help wanted! I need to create a resourceless dialog box. I want it to use a WndProc instead if a DlgProc, and I want to use CreateWindow instead of CreateDialog or variants. Is there a standard window class which I can use to accomplish this task? I was thinking of:
CreateWindow(TEXT("DIALOG"), TEXT("HELLO"), WS_VISIBLE, ...)
^^^^^^
The window classThanks in advance LPCTSTR Dutch = TEXT("Double Dutch :-)");
S van Leent wrote: Is there a standard window class which I can use to accomplish this task? No, you have to create your own. The closest thing to this is using a standard/common style bit when creating your own class. Here's a typical one. And, hInstance should be the same value that's passed to your
WinMain
() procedure.TCHAR szClassName[] = _T("Pick Something Unique"); // main window's class name
WNDCLASS wc; // window's class struct...
// first we must specify the attribs for the window's class
wc.style = CS_DBLCLKS|CS_HREDRAW|CS_VREDRAW;// style bits
wc.lpfnWndProc = (WNDPROC)WndProc; // window procedure to use
wc.cbClsExtra = 0; // no extra data
wc.cbWndExtra = 0; // no extra data
wc.hInstance = hInstance; // associated instance
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); // large/small icon
wc.hCursor = LoadCursor(NULL, IDC_ARROW); // default cursor
wc.hbrBackground = (HBRUSH)(COLOR_3DFACE+1); // window background color
wc.lpszMenuName = MAKEINTRESOURCE(IDR_MAINFRAME); // load the main menu
wc.lpszClassName = szClassName; // class name// now, we can register this class
RegisterClass(&wc);...
// use our class to try and create a window
hWnd = CreateWindow(szClassName, // class to use
_T("Hey"), // title for window
WS_OVERLAPPEDWINDOW,// style bits
100, 100, // position (x, y)
200, 200, // width/height
NULL, // no parent
NULL, // no menu
hInstance, // associated instance
NULL); // no extra dataJeremy Falcon
-
S van Leent wrote: Is there a standard window class which I can use to accomplish this task? No, you have to create your own. The closest thing to this is using a standard/common style bit when creating your own class. Here's a typical one. And, hInstance should be the same value that's passed to your
WinMain
() procedure.TCHAR szClassName[] = _T("Pick Something Unique"); // main window's class name
WNDCLASS wc; // window's class struct...
// first we must specify the attribs for the window's class
wc.style = CS_DBLCLKS|CS_HREDRAW|CS_VREDRAW;// style bits
wc.lpfnWndProc = (WNDPROC)WndProc; // window procedure to use
wc.cbClsExtra = 0; // no extra data
wc.cbWndExtra = 0; // no extra data
wc.hInstance = hInstance; // associated instance
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); // large/small icon
wc.hCursor = LoadCursor(NULL, IDC_ARROW); // default cursor
wc.hbrBackground = (HBRUSH)(COLOR_3DFACE+1); // window background color
wc.lpszMenuName = MAKEINTRESOURCE(IDR_MAINFRAME); // load the main menu
wc.lpszClassName = szClassName; // class name// now, we can register this class
RegisterClass(&wc);...
// use our class to try and create a window
hWnd = CreateWindow(szClassName, // class to use
_T("Hey"), // title for window
WS_OVERLAPPEDWINDOW,// style bits
100, 100, // position (x, y)
200, 200, // width/height
NULL, // no parent
NULL, // no menu
hInstance, // associated instance
NULL); // no extra dataJeremy Falcon
Well then, is there a way to at least create a dialogbox without a resource? LPCTSTR Dutch = TEXT("Double Dutch :-)");
-
Well then, is there a way to at least create a dialogbox without a resource? LPCTSTR Dutch = TEXT("Double Dutch :-)");
Check out
CreateDialogIndirect
(). Jeremy Falcon -
Check out
CreateDialogIndirect
(). Jeremy FalconThanks, though I'm using CreateDialogIndirectParam and DialogBoxIndirectParam right now LPCTSTR Dutch = TEXT("Double Dutch :-)");