Is there a way to override the forms default window class name ..
(WindowsForms10.Window.8.....) ?
I tried to override CreateParams but got an exception
System.ComponentModel.Win32Exception "Invalid window class name"
Can someone please help as my app needs to be located by a c++ app
which is using FindWindow() method.
Any help will be greatly appreciated...
Sijin Joseph - 15 Oct 2004 04:51 GMT
Why not use the window title to find the window?
Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph
> Is there a way to override the forms default window class name ..
> (WindowsForms10.Window.8.....) ?
[quoted text clipped - 6 lines]
>
> Any help will be greatly appreciated...
Herfried K. Wagner [MVP] - 15 Oct 2004 08:23 GMT
"Manpreet Randhawa" <petalsidhu@hotmail.com> schrieb:
> Is there a way to override the forms default window class name ..
> (WindowsForms10.Window.8.....) ?
[quoted text clipped - 4 lines]
> Can someone please help as my app needs to be located by a c++ app
> which is using FindWindow() method.
Maybe you can base an implementation of the control on 'NativeWindow' and
set the window class name there. But this will require you to reimplement
the whole control...

Signature
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/
Jakob Christensen - 15 Oct 2004 10:53 GMT
It makes no sense to try to change the Windows class name. The class name is
a system-wide unique name for each TYPE of window. This means that all
combobox'es have the same class name, all buttons have the same class name
etc. Whenever calling the Win32 CreateWindow you must specify the class name
to tell Windows which kind of window it should create. All windows classes
must be registered with RegisterClass before the name can be used with
CreateWindow (I recommend Brent Rector's book on Win32 programming if you are
interested).
If you want to use FindWindow, you should use the title of the window to
find it.
HTH, Jakob.
> Is there a way to override the forms default window class name ..
> (WindowsForms10.Window.8.....) ?
[quoted text clipped - 6 lines]
>
> Any help will be greatly appreciated...
Manpreet Randhawa - 15 Oct 2004 16:03 GMT
The reason for not using the window title in FindWindow is because the
title changes depending on whether a child form is open or not as the
name of the child form is then appended to the title.
Is there another function which can be used in place of FindWindow on
the other side, which can somehow use the exe name or any other
alternative?
Jim - 27 Oct 2004 18:43 GMT
Manpret, the window title changes but the window name probably doesn't
change. Look at the Name property of the form. The other thing you can do is
to break point inside one of the event handles (like MouseMove or Paint) and
look at the sender object. This object can be cast back into a form pointer
and the name property can be extracted.
> The reason for not using the window title in FindWindow is because the
> title changes depending on whether a child form is open or not as the
[quoted text clipped - 3 lines]
> the other side, which can somehow use the exe name or any other
> alternative?