Home All Groups Group Topic Archive Search About

Different window class

Author
28 Jun 2005 5:38 PM
Dragon
Hello world! 8-]

I'm trying to create a form that will have different window class. I have
overridden the CreateParams property of a form as follows:
~
Protected Overrides ReadOnly Property CreateParams() As
System.Windows.Forms.CreateParams

Get

Dim tempCP As CreateParams = MyBase.CreateParams

tempCP.ClassName = "PlaySmth.Class"

Return tempCP

End Get

End Property

~

.... but I'm getting System.ComponentModel.Win32Exception.

I think I have to register this new window class, but I can't do this
without original class info. But

~

Dim WC as WNDCLASS

GetClassInfo(0, Old_Class_Name, WC)

~

failed.

So, does anyone know how to get info on old window class, or, maybe, a
different way to change class of a window being created?

Thanks in advance.

Dragon

Author
29 Jun 2005 8:16 AM
Mattias Sjögren
>I think I have to register this new window class, but I can't do this
>without original class info. But
>
>~
>
>Dim WC as WNDCLASS
>
>GetClassInfo(0, Old_Class_Name, WC)
>
>~
>
>failed.


Failed in what way?



Mattias

--
Mattias Sjögren [MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Author
29 Jun 2005 10:10 AM
Dragon
> Failed in what way?

I mean, GetClassInfo returned 0, and there were no changes in the WC
structure.
Marshal.GetLastWin32Error gave me 87.

I suspect the trouble is with first GetClassInfo parameter. I assumed that
old class was created by OS, but it seems that it wasn't. Unfortunately, I
have no idea what should I substitute for hInstance.

Any suggestions?