Windows类名无效错误-VS 2008/C#
我用一个按钮和一个文本框创建了一个表单应用程序,看看是否可以重新创建这个错误,我做到了。编译并尝试使用F5运行时,我不断遇到此错误Windows类名无效错误-VS 2008/C#,c#,visual-studio-2008,C#,Visual Studio 2008,我用一个按钮和一个文本框创建了一个表单应用程序,看看是否可以重新创建这个错误,我做到了。编译并尝试使用F5运行时,我不断遇到此错误 at System.Windows.Forms.NativeWindow.WindowClass.RegisterClass() at System.Windows.Forms.NativeWindow.WindowClass.Create(String className, Int32 classStyle) at System.Window
at System.Windows.Forms.NativeWindow.WindowClass.RegisterClass()
at System.Windows.Forms.NativeWindow.WindowClass.Create(String className, Int32 classStyle)
at System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)
at System.Windows.Forms.Control.CreateHandle()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
这是我的主要观点:
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
**Application.Run(new Form1());**
}
粗体显示的行出现错误,可能与错误版本的comctl32.dll或类似dll有关。以下是围绕TreeView展开的讨论:
在VisualStudio2005中处理旧项目时遇到此问题。经过一段时间的搜索后,我的内存被缓慢移动到足以记住这与Visual Studio宿主进程有关,我通过执行以下操作修复了它: -进入构建->清洁解决方案 -退出Visual Studio,打开Windows资源管理器,然后转到正在使用的配置的bin目录(即,如果您处于调试配置中,请转到\bin\Debug)。 -那里应该只剩下几个文件,最明显的是宿主进程可执行文件(.vshost.exe)。删除此文件,为安全起见,请删除与宿主进程可执行文件关联的任何.config和.manifest文件。 -重新启动Visual Studio并重新生成解决方案 可以通过删除宿主进程的可执行文件而不清理解决方案来解决此问题。也可以通过转到项目属性、调试设置并取消选中“启用VisualStudio宿主进程”复选框来删除可执行文件。不过,宿主进程会加快加载调试版本的速度,因此如果可以,请重新启用它 (编辑)在重新审视这一点之后,我找到了另一个可能的解决方案。在调用Application.Run()之前,将以下行添加到Main()函数中:
仅仅发布一个链接被认为是不好的形式。我会编辑它一点,如果你不喜欢,请回滚。
Application.EnableVisualStyles();