📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
BorderStyle = 1 'Fixed Single
Caption = "工作站配置信息"
ClientHeight = 2790
ClientLeft = 45
ClientTop = 330
ClientWidth = 6375
Icon = "Form1.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2790
ScaleWidth = 6375
StartUpPosition = 2 '屏幕中心
Begin VB.ListBox LstConfig
Height = 1320
Left = 120
TabIndex = 1
Top = 720
Width = 6135
End
Begin VB.CommandButton CmdRun
Caption = "运行(&R)"
Height = 375
Left = 120
TabIndex = 0
Top = 2160
Width = 855
End
Begin VB.Label Label9
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "根目录"
Height = 180
Left = 5400
TabIndex = 10
Top = 360
Width = 540
End
Begin VB.Label Label8
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "次版本号"
Height = 180
Left = 4560
TabIndex = 9
Top = 360
Width = 720
End
Begin VB.Label Label7
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "主版本号"
Height = 180
Left = 3720
TabIndex = 8
Top = 360
Width = 720
End
Begin VB.Label Label6
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "平台ID"
Height = 180
Left = 3000
TabIndex = 7
Top = 360
Width = 540
End
Begin VB.Label Label5
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "用户数"
Height = 180
Left = 2280
TabIndex = 6
Top = 360
Width = 540
End
Begin VB.Label Label4
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "局域网组"
Height = 180
Left = 1440
TabIndex = 5
Top = 360
Width = 720
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "计算机"
Height = 180
Left = 120
TabIndex = 4
Top = 360
Width = 540
End
Begin VB.Label Label2
Caption = "Label2"
Height = 255
Left = 4560
TabIndex = 3
Top = 2280
Width = 615
End
Begin VB.Label Label1
Caption = "Label1"
Height = 255
Left = 1200
TabIndex = 2
Top = 2280
Width = 3015
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub CmdRun_Click()
Dim bufptr As Long
Dim dwServer As Long
Dim success As Long
Dim nStructSize As Long
Dim bServer As String
Dim ws102 As WKSTA_INFO_102
bServer = "\\" & Environ$("COMPUTERNAME") & vbNullString
dwServer = StrPtr(bServer)
success = NetWkstaGetInfo(dwServer, 102, bufptr)
LstConfig.Clear
Label2.Caption = success
If success = NERR_SUCCESS And success <> ERROR_MORE_DATA Then
nStructSize = LenB(ws102)
'将数据转换为WKSTA_INFO_102类型,并将其添加到列表中
CopyMemory ws102, ByVal bufptr, nStructSize
LstConfig.AddItem GetPointerToByteStringW(ws102.wki102_computername) & vbTab & _
GetPointerToByteStringW(ws102.wki102_langroup) & vbTab & _
ws102.wki102_logged_on_users & vbTab & _
ws102.wki102_platform_id & vbTab & _
ws102.wki102_ver_major & vbTab & _
ws102.wki102_ver_minor & vbTab & _
GetPointerToByteStringW(ws102.wki102_lanroot)
End If
Call NetApiBufferFree(bufptr)
End Sub
Private Sub Form_Load()
ReDim TabArray(0 To 6) As Long
'设置制表位,用户可根据需要进行调整
TabArray(0) = 60
TabArray(1) = 70
TabArray(2) = 80
TabArray(3) = 110
TabArray(4) = 130
TabArray(5) = 180
TabArray(6) = 210
Call SendMessage(LstConfig.hwnd, LB_SETTABSTOPS, 0&, ByVal 0&)
Call SendMessage(LstConfig.hwnd, LB_SETTABSTOPS, 7&, TabArray(0))
LstConfig.Refresh
Label1.Caption = "成功调用(0)或错误:"
Label2.Caption = ""
End Sub
Private Function GetPointerToByteStringW(ByVal dwData As Long) As String
Dim tmp() As Byte
Dim tmplen As Long
If dwData <> 0 Then
tmplen = lstrlenW(dwData) * 2
If tmplen <> 0 Then
ReDim tmp(0 To (tmplen - 1)) As Byte
CopyMemory tmp(0), ByVal dwData, tmplen
GetPointerToByteStringW = tmp
End If
End If
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -