⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 获得计算机名和用户名.frm

📁 Windows API函数,希望大伙有用哦
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   BackColor       =   &H80000004&
   Caption         =   "Form1"
   ClientHeight    =   1605
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4335
   LinkTopic       =   "Form1"
   ScaleHeight     =   1605
   ScaleWidth      =   4335
   StartUpPosition =   3  '窗口缺省
   Begin VB.TextBox Text2 
      Alignment       =   1  'Right Justify
      Height          =   345
      Left            =   1770
      TabIndex        =   1
      Text            =   "Text2"
      Top             =   780
      Width           =   1755
   End
   Begin VB.TextBox Text1 
      Alignment       =   1  'Right Justify
      Height          =   345
      Left            =   1770
      TabIndex        =   0
      Text            =   "Text1"
      Top             =   240
      Width           =   1755
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      Caption         =   "用户名:"
      Height          =   180
      Left            =   600
      TabIndex        =   3
      Top             =   870
      Width           =   720
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "计算机名:"
      Height          =   180
      Left            =   570
      TabIndex        =   2
      Top             =   330
      Width           =   900
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Declare Function GetComputerName& Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long)
Private Declare Function GetUserName& Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long)
Private Sub Form_Load()
  Dim strRetu As String * 256
     GetComputerName strRetu, 255
     Text1 = Left(strRetu, InStr(strRetu, Chr(0)) - 1)
     GetUserName strRetu, 255
     Text2 = Left(strRetu, InStr(strRetu, Chr(0)) - 1)
End Sub

⌨️ 快捷键说明

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