设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
查看: 2261|回复: 1
打印 上一主题 下一主题

[API] 菜鸟提问几个问题!获取计算机名、和当前文件的修改时间!

[复制链接]
跳转到指定楼层
1#
发表于 2006-8-30 00:02:00 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
请问如何用VBA获取当前计算机的名字,和当前的MDE文件的修改时间!!



谢谢。。偶是菜鸟,有提问错误的地方,请高手原谅!!
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享 分享淘帖 订阅订阅
2#
 楼主| 发表于 2006-8-30 00:24:00 | 只看该作者
获取计算机名和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
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-11-3 01:29 , Processed in 0.089052 second(s), 26 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表