Hi,
I have the following lines of code:
WNDCLASS wc;
memset (&wc, 0, sizeof (wc));
wc.hbrBackground = GetSysColorBrush (COLOR_WINDOW);
wc.hInstance = GetModuleHandle (NULL);
wc.lpfnWndProc = (WNDPROC)e3dxgine::Window::WndProc;
wc.lpszClassName = "__e3dxgine_Wnd";
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.hCursor = LoadCursor (NULL, IDC_ARROW);
if (RegisterClass (&wc) == 0)
return false;
NativeWindow *w = new NativeWindow ();
CreateParams *cp = new CreateParams ();
cp->Caption = "e3dxgine";
cp->ClassName = "__e3dxgine_Wnd";
cp->ClassStyle = CS_HREDRAW | CS_VREDRAW;
cp->Style = WS_OVERLAPPEDWINDOW;
w->CreateHandle (cp);
hWindow = (HWND)(w->Handle.ToPointer ());
return true;
They cause this exception:
Unhandled Exception: System.ComponentModel.Win32Exception: Invalid window
class
name.
at System.Windows.Forms.WindowClass.RegisterClass()
at System.Windows.Forms.WindowClass.Create(String className, Int32
classStyle
)
at System.Windows.Forms.NativeWindow.CreateHandle(Cre ateParams cp)
at e3dxgine.Window.Initialize() in d:\e3dxgine\window.cpp:line 116
at e3dxgine.Engine..ctor() in d:\e3dxgine\engine.cpp:line 38
at e3dxgine.Shooter.Engine..ctor()
...
Press any key to continue
I am trying to register a new window class and get a NativeWindow instance
of it. What's wrong with that?
Regards,
Felix Arends