窗口类名称无效。 [英] Window class name is not valid.
问题描述
当我尝试在Visual Studio 2005中调试时,我收到75%的错误。 我重新安装了VS并应用了最新的服务包而没有任何缓解。 如果我在没有调试的情况下运行,只有在我尝试调试时才会发生。 它发生在我创建的每个项目中,它不是孤立于单个项目或解决方案。 非常感谢任何帮助。
它总是被抛到这一行(或等效物):
public 静态 void Main( string [] args)
public static void Main(string[] args)
{
应用 。运行( new MainForm ());
Application.Run(new MainForm());
}
System.ComponentModel.Win32Exception未处理
Message ="窗口类名称无效。"
源= "System.Windows.Forms的"
 错误码= -2147467259
  NativeErrorCode = 0
 堆栈跟踪:
      在System.Windows.Forms.NativeWindow.WindowClass.RegisterClass()
在System.Windows.Forms.NativeWindow.WindowClass.Create(String className,Int32 classStyle)
在System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)
在System.Windows.Forms.Control.CreateHandle()
在System.Windows.Forms.TreeView.CreateHandle()
在System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
在System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
在System.Windows.Forms.Control.CreateControl()
在System.Windows.Forms.Control.WmShowWindow(消息& m)
在System.Windows.Forms.Control.WndProc(消息& m)
在System.Windows.Forms.ScrollableControl.WndProc(消息& m)
在System.Windows.Forms.ContainerControl.WndProc(消息& m)
在System.Windows.Forms.Form.WmShowWindow(消息& m)
在System.Windows.Forms.Form.WndProc(消息& m)
在System.Windows.Forms.Control.ControlNativeWindow.OnMessage(消息& m)
在System.Windows.Forms.Control.ControlNativeWindow.WndProc(消息& m)
在System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,Int32 msg,IntPtr wparam,IntPtr lparam)
在System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd,Int32 nCmdShow)
在System.Windows.Forms.Control.SetVisibleCore(布尔值)
在System.Windows.Forms.Form.SetVisibleCore(布尔值)
在System.Windows.Forms.Control.set_Visible(布尔值)
在System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason,ApplicationContext context)
在System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason,ApplicationContext context)
在System.Windows.Forms.Application.Run(Form mainForm)
在JCARepository.MainForm.Main(String [] args)中的C:\Documents and Settings \John \ My Documents\JCA\Repository\\\
ew\MDIClient\Form1.cs:第266行
      在System.AppDomain.nExecuteAssembly(Assembly assembly,String [] args)
在System.AppDomain.ExecuteAssembly(String assemblyFile,Evidence assemblySecurity,String [] args)
在Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
在System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback回调,对象状态)
在System.Threading.ThreadHelper.ThreadStart()
System.ComponentModel.Win32Exception was unhandled
Message="Window class name is not valid."
Source="System.Windows.Forms"
ErrorCode=-2147467259
NativeErrorCode=0
StackTrace:
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.TreeView.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)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)
at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.set_Visible(Boolean value)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at JCARepository.MainForm.Main(String[] args) in C:\Documents and Settings\John\My Documents\JCA\Repository\new\MDIClient\Form1.cs:line 266
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
推荐答案
这是来自不同项目的另一个堆栈,同样的问题:
Here's another stack from a different project, same problem:
System.ComponentModel.Win32Exception未处理
Message ="窗口类名无效。"
Source =" System.Windows.Forms"
ErrorCode = -2147467259
NativeErrorCode = 0
StackTrace:
System.Windows.Forms.NativeWindow.WindowClass.RegisterClass()
at System.Windows.Forms .NativeWindow.WindowClass.Create(String className,Int32 classStyle)
System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)
at System.Windows.Forms.Control.CreateHandle()
at System .Windows.Forms.TextBoxBase.CreateHandle()
在System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
在System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
System.Windows.Fornd.Conp.PndProc上的System.Windows.Forms.Control.WndProc(Message& m)
System.Windows.Forms.ContainerControl中的System.Windows.Forms.ScrollableControl.WndProc(Message& m)
System.Windows上的System.Windows.Forms.Form.WndProc(Message& m)的System.Windows.Forms.Form.WmShowWindow(Message& m)的WndProc(Message& m)
。 Forms.Control.ControlNativeWindow.OnMessage(Message& m)
System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,Int32) msg,IntPtr wparam,IntPtr lparam)
在System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd,Int32 nCmdShow)
System.Windows.Forms.Control.SetVisibleCore(Boolean value)
at System System.Windows.Forms.Control.set_V上的.Windows.Forms.Form.SetVisibleCore(布尔值)
isible(布尔值)
System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason,ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason,ApplicationContext context)< br> at System.Windows.Forms.Application.Run(Form mainForm)
在ModuleLoader.Program.Main()中的C:\Documents and Settings \John \ My Documents \ JCA \ Repository \ JcaRepositoryService \ModuleLoader \Program.cs:第17行
System.AppDomain.nExecuteAssembly(程序集,String [] args)
System.AppDomain.ExecuteAssembly(String assemblyFile,Evidence assemblySecurity,String [] args )
在System.Threading.Thread上的System.Threading.ThreadPel.ThreadStart_Context(对象状态)中的Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
(ExecutionContext executionC) ontext,ContextCallback回调,对象状态)
在System.Threading.ThreadHelper.ThreadStart()
System.ComponentModel.Win32Exception was unhandled
Message="Window class name is not valid."
Source="System.Windows.Forms"
ErrorCode=-2147467259
NativeErrorCode=0
StackTrace:
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.TextBoxBase.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)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)
at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.set_Visible(Boolean value)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at ModuleLoader.Program.Main() in C:\Documents and Settings\John\My Documents\JCA\Repository\JcaRepositoryService\ModuleLoader\Program.cs:line 17
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
这篇关于窗口类名称无效。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!