msggetcomputername.bas

来自「vb做的数据库 客户管理系统」· BAS 代码 · 共 21 行

BAS
21
字号
Attribute VB_Name = "msgGetComputerName"
Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long

'获得我的计算机名
'--------------------------------------------------
Function sGetComputerName() As String

      Dim sBuffer As String
      Dim lBufSize As Long
      Dim lStatus As Long

      lBufSize = 255
      sBuffer = String$(lBufSize, " ")
      lStatus = GetComputerName(sBuffer, lBufSize)
      sGetComputerName = ""
      If lStatus <> 0 Then
            sGetComputerName = Left(sBuffer, lBufSize)
      End If

End Function

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?