作为创建窗口时,在VC ++中,我们需要创建一个窗口类和使用的RegisterClass或RegisterClassEx进行注册。但是,在.NET中,我们没有这一步。
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.
所以,我不知道默认的窗口类名创建表单时所分配由Visual Studio?
So I wonder what the default window class name assigned by Visual Studio when creating a form?
正如我跟踪了,由Visual Studio分配的窗口类名是有点类似这样: WindowsForms10.Window.8.app.0.1ca0192_r13_ad1
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?
推荐答案
是自动生成的窗口类名。你不能改变他们,即使的CreateParams可以让你设置的className属性。也可以将外部程序永远猜对自动生成的名称,它的一部分是从AppDomain.CurrentDomain.GetHash code产生的()。
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().
您还需要另一种方式来识别窗口。没有多少可用的,但你可以的PInvoke SetProp()到任意的字符串关联到一个窗口。并测试它是否是present与GetProp()。该SDK文章是这里。
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.
相关推荐
最新文章