Different window class

D

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
 
M

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
 
D

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top