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?
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.
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 .
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With