ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[¤À¨É] ¨Ï¥ÎAPI¶Ç¦^¹q¸£¦WºÙ

[¤À¨É] ¨Ï¥ÎAPI¶Ç¦^¹q¸£¦WºÙ

Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long

Sub Get_Computer_Name()
    Dim Comp_Name_B As String * 255
    Dim Comp_Name As String
    GetComputerName Comp_Name_B, Len(Comp_Name_B)
   
    'µM¦Ó¦¹¤@¦r¦ê¸g±`¥H null²Å¸¹§@¬°µ²§À¡A¦]¦¹¡A§Ú­Ì¨Ï¥Î Chr(0) ¨ç¼Æ¨Ó¨ú±oµ²§À
    Comp_Name = Left(Comp_Name_B, InStr(Comp_Name_B, Chr(0)))
   
    '¶È¶Ç¦^¹q¸£¦WºÙ
    MsgBox Comp_Name
End Sub

vs2010¤¤¡G MsgBox(System.Windows.Forms.SystemInformation.ComputerName)
1

µû¤À¤H¼Æ

    • Min: «D±`·PÁ±zªº¤À¨É~ª÷¿ú + 1
学习

TOP

        ÀR«ä¦Û¦b : ¥¬¬I¦p¼½ºØ¡A¥HÅw³ß¤ß´þ¼íºØ¤l¡A¤~·|µoªÞ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD