Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the window class name assigned by Visual Studio when creating .NET form?

As in VC++ when creating a window we need to create a window class and use RegisterClass or RegisterClassEx to register. But in .NET we don't have this step.

So I wonder what the default window class name assigned by Visual Studio when creating a form?

As I've tracked out, the window class name assigned by Visual Studio is somewhat similar to this:
WindowsForms10.Window.8.app.0.1ca0192_r13_ad1

I want to change this default window class name, any idea?

like image 944
jondinham Avatar asked Sep 13 '11 00:09

jondinham


People also ask

What it is the class form In c#?

The Form class can be used to create standard, tool, borderless, and floating windows. You can also use the Form class to create modal windows such as a dialog box.

Which base class is used for all the window control in Windows form application?

Forms. Form. This base class provides the functionality you need to design Windows Forms applications. The same concepts are used in all designable objects in Visual Studio .

How do you display a form in C #?

Press F5 to build and run the application. Click on the button in the main form to display the sub form. Now, when you press the button in the sub form, the form will be hidden.


1 Answers

Window class names are automatically generated. You cannot change them, even though CreateParams lets you set the ClassName property. Nor can an external program ever guess the auto-generated name correctly, part of it is generated from AppDomain.CurrentDomain.GetHashCode().

You'll need another way to identify the window. Not much available, but you could pinvoke SetProp() to associate an arbitrary string to a window. And test if it is present with GetProp(). The SDK article is here.

like image 148
Hans Passant Avatar answered Oct 12 '22 23:10

Hans Passant