Steve,
>Anyone know if this is possible and how?
Create a class derived from Control, override the CreateParams
property and use it to return the window class to use.
Mattias

Signature
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Steve Marsden - 13 Dec 2004 12:42 GMT
Mattias
Thanks for the reply. This sounds hopeful.
As a newbie I am OK creating the class derived from Control but nor sure
about overiiding the CreateParams property and returnng the windows class.
Could you gove me a short example.
Thanks
Steve
> Steve,
>
[quoted text clipped - 4 lines]
>
> Mattias
Steve Marsden - 13 Dec 2004 14:49 GMT
Further to the above I found some code which shoudl do what I want but it
fails with "Invalid Window Class Name"
public __gc class testclass : public System::Windows::Forms::Control
{
protected:
__property System::Windows::Forms::CreateParams * get_CreateParams()
{
System::Windows::Forms::CreateParams * createParams;
createParams = __super::get_CreateParams();
createParams->ClassName = "generic";
return createParams;
}
};
generic is a class I already have registered using RegisterClass elseeher in
my project
wndclass.lpszClassName="generic";
wndclass.lpfnWndProc=GenericProc;
wndclass.cbWndExtra=0;
wndclass.hbrBackground=dlgbkbr;
if (!RegisterClass(&wndclass))
return -1;
If I change "generic" to "BUTTON" so I am using a system class it works but
not with my own window class
Steve Marsden - 13 Dec 2004 15:42 GMT
I am tried changing my class stytle to CS_GLOBALCLASS and this removed the
error.
My only remaining problem now is my control is not being painted.
I have debugged I am definitely getting into the wndproc for my class but I
am not getting any WM_PAINT messages.
Any ideas?
Steve Marsden - 13 Dec 2004 15:47 GMT
PS I am getting WM_CREATE, WM_KEYDOWN messages just no WM_PAINT messages