VB6.0怎么获取电脑的名字?

2020-05-27 社会 73阅读
【方法一——最简单】在 工程菜单的部件里找到 Microsoft Winsock Control 然后添加。。它就显示在工具栏上winsock1.LocalHostName 【方法二——最正统】Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Public Function GetComputer() As String
Dim strCompName As String
Dim intHandle As IntegerstrCompName = String(256, " ")
intHandle = GetComputerName(strCompName, 256)
strCompName = Left(strCompName, InStr(1, strCompName, Chr(0)) - 1)
GetComputer = Trim(strCompName)
End Function然后调用这个函数即可
声明:你问我答网所有作品(图文、音视频)均由用户自行上传分享,仅供网友学习交流。若您的权利被侵害,请联系fangmu6661024@163.com