473,320 Members | 2,124 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Invalid Class Name with NativeWindow

edx
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
Nov 17 '05 #1
0 1596

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Kent Johnson | last post by:
We have a chat client written in C# that occasionally throws the following exceptions for our users (typically after prolonged use)... ArgumentException: Invalid parameter used. at...
3
by: Richard | last post by:
I have a requirement to put a GDI style circle or rectangle border around the selected row of a datagrid/ It will overlap into the row above and below the selected row. Doing this in a the OnPaint...
5
by: Nick Flandry | last post by:
I'm running into an Invalid Cast Exception on an ASP.NET application that runs fine in my development environment (Win2K server running IIS 5) and a test environment (also Win2K server running IIS...
9
by: MR | last post by:
I get the following Exception "The data at the root level is invalid. Line 1, position 642" whenever I try to deserialize an incoming SOAP message. The incoming message is formed well and its...
0
by: dbuchanan | last post by:
Hello, Why am I getting this error? I don't know how to isolate it. It occurs intermittently. Has anyone seen this before? Here is the full text \\ System.IO.FileLoadException was...
1
by: Java Guy | last post by:
I'm trying to view a web page. IE tells me there are (Java?) errors on the page. Here they are: Line: 15 Char: 7 Error: Wrong number of arguments or invalid propert assignment Code: 0 URL:...
2
by: JayvardhanPune | last post by:
I am facing a problem with my GDI++ code in C# control. Though i have tried many things from last 6 months, i am not able to get completely rid of this bug. Whenever the user is opening a...
3
by: tomko | last post by:
Hi, What is the right way to dispose of a NativeWindow? I guess the NativeWindow is managed code and will be cleared by the GC, but the window handle it is holding is a native handle! I'm...
4
by: mattehz | last post by:
Hey there, I am trying to upload old source files and came across these errors: Warning: Invalid argument supplied for foreach() in /home/mattehz/public_html/acssr/trunk/inc_html.php on line 59...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.