【发布时间】:2013-03-27 11:56:12
【问题描述】:
为什么我在使用以下代码启动 .NET 应用程序 (QCSearch.exe) 时收到 Error 6: Overflow:
Private Sub StartQCSearch()
Dim wsh As WshShell
Dim waitOnReturn As Boolean: waitOnReturn = True
Dim windowStyle As Integer: windowStyle = 1
Dim errorCode As Integer
Dim pth As String
Set wsh = New WshShell
pth = ThisWorkbook.Path & "\QCSearch.exe"
// Following line is marked, when debugging error 6:
errorCode = wsh.Run(pth, windowStyle, waitOnReturn)
If errorCode <> 0 Then
MsgBox "QCSearch.exe exited with error code " & errorCode & "."
End If
End Sub
.NET 应用程序(用 c# 编写)有一个主窗体,它打开一个对话框。 当我确认此对话框时,出现错误 6 并立即关闭 .NET 应用程序。
似乎对话框正在返回一些errorCode 无法分配的退出代码。
但正如我所说,我检查了我的 .NET 应用程序的退出代码,然而,它们通常不应该通过关闭任何对话框来返回,而是通过关闭主窗体来返回?!
另外,调试错误后,errorCode变量仍然赋值为0。
提前感谢您的帮助。
更新:
从 Windows CMD 启动 .NET 应用程序时,在确认对话框后也会中断。现在,我真的很困惑。有谁知道为什么内部对话框会关闭整个应用程序?
【问题讨论】: