VB6程序Main函数的返回值类型是什么?

2026-05-06 08:181阅读0评论SEO基础
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计326个文字,预计阅读时间需要2分钟。

VB6程序Main函数的返回值类型是什么?

我收到的印象是这是某种代码或脚本的一部分。以下是对其的简化改写,确保不超过100个字,不使用难词:

尝试锁定文档。若命令为空,记录开始文档锁定,执行锁定。否则,记录开始...

我得到的印象是这是不可能的,但这是我到目前为止所得到的.

Sub Main() On Error GoTo ErrorHandler If Command$= "" Then LogAction "Begin document lockdown" LockdownDocs LogAction "Lockdown complete" Else LogAction "Begin document enabling" EnableDocs LogAction "Documents have be enabled" End If Exit Sub ErrorHandler: LogAction "DocLock Error " & Err.Number & "::" & Err.Description End Sub

我希望它看起来像这样:

Function Main() As Boolean On Error GoTo ErrorHandler If Command$= "" Then LogAction "Begin document lockdown" LockdownDocs LogAction "Lockdown complete" Else LogAction "Begin document enabling" EnableDocs LogAction "Documents have be enabled" End If Return True Exit Function ErrorHandler: LogAction "Error " & Err.Number & "::" & Err.Description Return False End Function

我见过的最接近的是Visual Studio 2005中的Function Main()As Integer,但我使用的是VB6.

通过使用Win32 API调用,可能有一个解决方案 here.在本质上:

Private Declare Sub ExitProcess Lib "kernel32" (ByVal uExitCode As Long) ' Exit with ErrorLevel set to 9 ExitProcess 9

请注意,这相当于VB运行时的结束,因此您必须在调用ExitProcess之前执行任何清理,关闭连接,文件,设备,表单等.

VB6程序Main函数的返回值类型是什么?

标签:

本文共计326个文字,预计阅读时间需要2分钟。

VB6程序Main函数的返回值类型是什么?

我收到的印象是这是某种代码或脚本的一部分。以下是对其的简化改写,确保不超过100个字,不使用难词:

尝试锁定文档。若命令为空,记录开始文档锁定,执行锁定。否则,记录开始...

我得到的印象是这是不可能的,但这是我到目前为止所得到的.

Sub Main() On Error GoTo ErrorHandler If Command$= "" Then LogAction "Begin document lockdown" LockdownDocs LogAction "Lockdown complete" Else LogAction "Begin document enabling" EnableDocs LogAction "Documents have be enabled" End If Exit Sub ErrorHandler: LogAction "DocLock Error " & Err.Number & "::" & Err.Description End Sub

我希望它看起来像这样:

Function Main() As Boolean On Error GoTo ErrorHandler If Command$= "" Then LogAction "Begin document lockdown" LockdownDocs LogAction "Lockdown complete" Else LogAction "Begin document enabling" EnableDocs LogAction "Documents have be enabled" End If Return True Exit Function ErrorHandler: LogAction "Error " & Err.Number & "::" & Err.Description Return False End Function

我见过的最接近的是Visual Studio 2005中的Function Main()As Integer,但我使用的是VB6.

通过使用Win32 API调用,可能有一个解决方案 here.在本质上:

Private Declare Sub ExitProcess Lib "kernel32" (ByVal uExitCode As Long) ' Exit with ErrorLevel set to 9 ExitProcess 9

请注意,这相当于VB运行时的结束,因此您必须在调用ExitProcess之前执行任何清理,关闭连接,文件,设备,表单等.

VB6程序Main函数的返回值类型是什么?

标签: