4. Åã¥Ü¾¹ªº¿Ã¹õ¸ÑªR«×
'32-bit API declaration
Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
Public Const SM_CXSCREEN = 0
Public Const SM_CYSCREEN = 1
Sub ScreenResolution()
¡@ VidWidth = GetSystemMetrics(SM_CXSCREEN)
¡@ VidHeight = GetSystemMetrics(SM_CYSCREEN)
¡@ MsgBox "¾³~ ¥Ø«e¿Ã¹õ¸ÑªR«×¬O: " & VidWidth & " X " & VidHeight
End Sub
¥H¤U¨Ó¦Û John Walkenbach
For Excel tips, macros, & downloads... http://j-walk.com/ss
1. ¨ú±o¹q¸£¦WºÙ
Private Declare Function w32_GetComputerName Lib "kernel32" _
Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Public Function GetComputerName()
¡@ Dim sComputerName As String
¡@ Dim lComputerNameLen As Long
¡@ Dim lResult As Long
¡@ lComputerNameLen = 256
¡@ sComputerName = Space(lComputerNameLen)
¡@ lResult = w32_GetComputerName(sComputerName, lComputerNameLen)
¡@ If lResult <> 0 Then
¡@¡@¡@ GetComputerName = Left(sComputerName, lComputerNameLen)
¡@ Else
¡@¡@¡@ GetComputerName = "Unknown"
¡@ End If
End Function
2. ¨ú±o¹q¸£¥Ø«eµn¤J¨Ï¥ÎªÌ¦WºÙ
Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" _
¡@(ByVal lpBuffer As String, nSize As Long) As Long
Function UserName() As String
¡@¡@Dim Buffer As String * 100
¡@¡@Dim BuffLen As Long
¡@¡@BuffLen = 100
¡@¡@GetUserName Buffer, BuffLen
¡@¡@UserName = Left(Buffer, BuffLen - 1)
End Function
--------------------------------------------------------------------------------
¸É¥R¡G
¨ä¹ê¦³¨Ç¨t²Î/¨Ï¥ÎªÌ¸ê°T¥i¥H¥ÑÀô¹ÒÅܼƨú±o¡C
°Ñ¦Ò ¥Î Environ ¨ú±oÀô¹ÒÅܼÆ~ ¤£¬O«DnAPI °Õ
¦VªO¥DÀËÁ| 203.79.168.37 (?)
--------------------------------------------------------------------------------
BEFORE ASKING, YOU SHOULD RTFH, RTFM, STFW...
¤U±½d¨Ò¬O·j¯Á¨t²Î¤¤¦w¸Ëªººô¥d¨Ãªð¦^ºô¥d IP ¤Î MAC ¦ì§}¡G
¨ú±o¥»¾÷ºô¥d IP ¦ì§} --
Sub Get_IP()
Dim objWMI As Object
Dim colIP As Object
strComputer = "."
Set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colIP = objWMI.ExecQuery _
¡@("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
For Each IP In colIP
¡@If Not IsNull(IP.IPAddress) Then
¡@¡@¡@For i = LBound(IP.IPAddress) To UBound(IP.IPAddress)
¡@¡@¡@¡@MsgBox IP.IPAddress(i), vbInformation, IP.Description(i)
¡@¡@¡@Next
¡@End If
Next
End Sub
¨ú±o¥»¾÷ºô¥d MAC Address (¹êÅé¦ì§}) --
Sub Get_Mac_Addr()
Dim objWMI As Object
Dim colItems As Object
strComputer = "."
Set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMI.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration", _
¡@¡@"WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each objItem In colItems
¡@MsgBox "MAC Address: " & objItem.MACAddress
Next
End Sub
¦VªO¥DÀËÁ| 203.79.168.37 (?)
--------------------------------------------------------------------------------
BEFORE ASKING, YOU SHOULD RTFH, RTFM, STFW...
--------------------------------------------------------------------------------
BEFORE ASKING, YOU SHOULD RTFH, RTFM, STFW...§@ªÌ: brabus ®É¶¡: 2013-10-9 20:58