Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / October 2004

Tip: Looking for answers? Try searching our database.

Change Windows Class Name

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Manpreet Randhawa - 15 Oct 2004 00:03 GMT
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?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.