indiocolifa
September 13th, 2003, 05:02 PM
I'm doing the following to create a new class based on the system dialog class (#32770) to do my program's main window, which of course, is a dialog.
The code that fails:
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE prevInstance,
PSTR cmdLine, int nCmdShow)
{
static char szClassName[] = "MCW";
HWND hwnd;
MSG msg;
WNDCLASSEX wcex;
HACCEL hAccel;
// Get the class for the system dialog class
wcex.cbSize = sizeof(WNDCLASSEX);
GetClassInfoEx(NULL, "#32770", &wcex);
// Register class
wcex.lpszClassName = szClassName;
wcex.cbClsExtra = 0;
wcex.hInstance = hInstance;
wcex.hbrBackground = (HBRUSH) (COLOR_BTNFACE+1);
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hIcon = LoadIcon (hInstance, MAKEINTRESOURCE( IDI_MCWICON));
wcex.hIconSm = LoadIcon (hInstance, MAKEINTRESOURCE( IDI_MCWICON));
wcex.cbWndExtra = DLGWINDOWEXTRA;
wcex.lpfnWndProc = WndProc;
wcex.lpszMenuName = MAKEINTRESOURCE(IDR_MENU1);
RegisterClassEx(&wcex);
if (!RegisterClassEx(&wcex))
{
MessageBox (NULL, "Error in RegisterClassEx", "error", MB_ICONERROR);
return 0;
}
Why this fails?
The code that fails:
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE prevInstance,
PSTR cmdLine, int nCmdShow)
{
static char szClassName[] = "MCW";
HWND hwnd;
MSG msg;
WNDCLASSEX wcex;
HACCEL hAccel;
// Get the class for the system dialog class
wcex.cbSize = sizeof(WNDCLASSEX);
GetClassInfoEx(NULL, "#32770", &wcex);
// Register class
wcex.lpszClassName = szClassName;
wcex.cbClsExtra = 0;
wcex.hInstance = hInstance;
wcex.hbrBackground = (HBRUSH) (COLOR_BTNFACE+1);
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hIcon = LoadIcon (hInstance, MAKEINTRESOURCE( IDI_MCWICON));
wcex.hIconSm = LoadIcon (hInstance, MAKEINTRESOURCE( IDI_MCWICON));
wcex.cbWndExtra = DLGWINDOWEXTRA;
wcex.lpfnWndProc = WndProc;
wcex.lpszMenuName = MAKEINTRESOURCE(IDR_MENU1);
RegisterClassEx(&wcex);
if (!RegisterClassEx(&wcex))
{
MessageBox (NULL, "Error in RegisterClassEx", "error", MB_ICONERROR);
return 0;
}
Why this fails?