【问题标题】:What is WndProc message 24什么是 WndProc 消息 24
【发布时间】:2012-02-29 19:46:06
【问题描述】:

我目前正在尝试运行现有的 VB.NET 项目。 WndProc 消息中引发了一个空指针异常,但堆栈跟踪并没有真正给我任何信息。我可以在启动表单的设计器代码中放置一个断点,但是当我单步执行它时,会通过 WndProc 函数触发 NULL 指针异常。上面的方法似乎是 Windows 方法。我唯一的线索是 Msg = 24 和 WParam = 1 的 Message 参数。我认为 HWnd = 5178884 没有帮助。

我正在粘贴堆栈跟踪,以防有人有任何想法。 注意:我屏蔽了 MyNamespace 和 MyBaseForm 和 MyFormA,因为源代码是专有的。这在 .NET Framework 3.5 上的 Visual Studio 2008 中运行

MyNamespace.Forms.MyBaseForm.WndProc(Message& m)\r\n   
System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)\r\n   
System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)\r\n   
System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)\r\n   
System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)\r\n   
System.Windows.Forms.Control.SetVisibleCore(Boolean value)\r\n   
System.Windows.Forms.Form.SetVisibleCore(Boolean value)\r\n   
System.Windows.Forms.Control.set_Visible(Boolean value)\r\n   
System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)\r\n   
System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)\r\n   
System.Windows.Forms.Application.Run(ApplicationContext context)\r\n   
Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()\r\n   
Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()\r\n   
Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)\r\n   
MyFormA.My.MyApplication.Main(String[] Args) 
17d14f5c-a337-4978-8281-53493378c1071.vb:Line 81\r\n   
System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)\r\n   
System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)\r\n   
Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()\r\n   
System.Threading.ThreadHelper.ThreadStart_Context(Object state)\r\n   
System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)\r\n   
System.Threading.ThreadHelper.ThreadStart()"

【问题讨论】:

    标签: vb.net nullpointerexception wndproc


    【解决方案1】:

    WM_SHOWWINDOW = 24

    ...并不是说它真的有帮助。 看起来您要执行的代码的最后一点是第 81 行,我会研究一下。

    【讨论】:

    • 谢谢。我猜测第 81 行调用来自系统 api,因为它调用了 MyFormA.My.MyApplication.Main。可能是视觉工作室的一部分。这个名字是一个向导。这可能不是原因。
    • 这里要补充的是对WM_SHOWWINDOW的引用。 winapi.freetechsecrets.com/win32/WIN32WMSHOWWINDOW.htm
    【解决方案2】:

    我只是想就如何知道错误来自哪里,即使堆栈跟踪没有告诉你任何东西(我问什么是 WndProc 24 的实际问题)给出另一个答案。以防其他人也有同样的问题。

    我使用了 Visual Studio 上的“通过调试”>“异常”菜单的未处理异常。有关详细信息,请参阅此link

    在 C.Barlow 回答最初的问题时继续指出这一点。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-30
      • 1970-01-01
      • 2010-10-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多