Office中国论坛/Access中国论坛
标题:
菜鸟提问几个问题!获取计算机名、和当前文件的修改时间!
[打印本页]
作者:
kingboyszxf
时间:
2006-8-30 00:02
标题:
菜鸟提问几个问题!获取计算机名、和当前文件的修改时间!
请问如何用VBA获取当前计算机的名字,和当前的MDE文件的修改时间!!
谢谢。。偶是菜鸟,有提问错误的地方,请高手原谅!!
作者:
kingboyszxf
时间:
2006-8-30 00:24
获取计算机名和IP的问题我已经解决了,,
现在不知道怎么获取文件名和文件的修改时间==== 还有就是系统退出的时候调用批处理文件。。
获取计算机名和IP的代码如下:(只需要建立一个模块就可以了)
或许本网站有了很多,在这里,再贴一次,希望对不知道的人有所帮助。。
Private Const WS_VERSION_REQD = &H101
Private Const WS_VERSION_MAJOR = WS_VERSION_REQD \ &H100 And &HFF&
Private Const WS_VERSION_MINOR = WS_VERSION_REQD And &HFF&
Private Const MIN_SOCKETS_REQD = 1
Private Const SOCKET_ERROR = -1
Private Const WSADescription_Len = 256
Private Const WSASYS_Status_Len = 128
Private Type HOSTENT
hName As Long
hAliases As Long
hAddrType As Integer
hLength As Integer
hAddrList As Long
End Type
Private Type WSADATA
wversion As Integer
wHighVersion As Integer
szDescription(0 To WSADescription_Len) As Byte
szSystemStatus(0 To WSASYS_Status_Len) As Byte
iMaxSockets As Integer
iMaxUdpDg As Integer
lpszVendorInfo As Long
End Type
Declare Function wu_GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Declare Function wu_GetComputerName Lib "kernel32.dll" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Private Declare Function WSAGetLastError Lib "WSOCK32.DLL" () As Long
Private Declare Function WSAStartup Lib "WSOCK32.DLL" (ByVal wVersionRequired&, lpWSAData As WSADATA) As Long
Private Declare Function WSACleanup Lib "WSOCK32.DLL" () As Long
Private Declare Function gethostbyname Lib "WSOCK32.DLL" (ByVal hostname$) As Long
Private Declare Sub RtlMoveMemory Lib "kernel32" (hpvDest As Any, ByVal hpvSource&, ByVal cbCopy&)
Function ap_GetComputerName() As Variant
欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/)
Powered by Discuz! X3.3