获得计算机名:
Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Private Sub Form_Load()
'KPD-Team 1998
'URL: http://www.allapi.net/
'E-Mail: [email protected]
Dim strString As String
'Create a buffer
strString = String(255, Chr$(0))
'Get the computer name
GetComputerName strString, 255
'remove the unnecessary chr$(0)'s
strString = Left$(strString, InStr(1, strString, Chr$(0)))
'Show the computer name
MsgBox strString
End Sub获得本地IP地址,比较烦要用一大队API,所以最好的办法就是放个WINSOCK控件,然后
debug.print winsock1.localip
Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Private Sub Form_Load()
'KPD-Team 1998
'URL: http://www.allapi.net/
'E-Mail: [email protected]
Dim strString As String
'Create a buffer
strString = String(255, Chr$(0))
'Get the computer name
GetComputerName strString, 255
'remove the unnecessary chr$(0)'s
strString = Left$(strString, InStr(1, strString, Chr$(0)))
'Show the computer name
MsgBox strString
End Sub获得本地IP地址,比较烦要用一大队API,所以最好的办法就是放个WINSOCK控件,然后
debug.print winsock1.localip
解决方案 »
- 菜鸟求助急急急急急急急急
- 大哥们,又要请你们帮忙了!
- 高分求:如何将listview表格中的内容导出到EXCEL2000文件中?
- 为何我不能够建Microsoft 数据链文件(Data Link file)(.UDL)???
- 如果一个ocx已经实现了对自身某个事件的响应
- 题目是:计算x/y的值,x>20!可是我输出会益出。谢谢给我指点。
- 中文的MSDN哪里有下载,谢谢!
- VB的数据库连接及使用!怎么存储用户信息~!
- 我想编个拨号连接,不是调用!
- 中国人有自己的数据库吗?
- 请问在IE上打开了word文档,修改后又重新保存到服务器上,怎么实现???(急。。。)
- 远程SQL服务器连接?提示服务器不存在或访问被拒绝
Private Declare Function GetComputerName Lib "kernel32" alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long Private Sub Command1_Click()Dim strName As String, lngLength As Long lngLength = 225
strName = String(lngLength, Chr(0))
GetComputerName strName, lngLength
strName = Left(strName, lngLength)
msgbox strNameEnd Sub
计算机名称=winsock1.localhostname
IP= winsock1.localhostip
Private Declare Function GetComputerName Lib "kernel32" alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long Private Sub Command1_Click()Dim strName As String, lngLength As Long lngLength = 225
strName = String(lngLength, Chr(0))
GetComputerName strName, lngLength
strName = Left(strName, lngLength)
msgbox strNameEnd Sub试试
Q160215 HOWTO: Obtain the Host IP Address Using Windows Sockets
http://support.microsoft.com/support/kb/articles/q160/2/15.asp
- 微软全球技术中心 VB技术支持本贴子以“现状”提供且没有任何担保,同时也没有授予任何权利。具体事项可参见使用条款
(http://support.microsoft.com/directory/worldwide/zh-cn/community/terms_chs.asp)。
为了为您创建更好的讨论环境,请参加我们的用户满意度调查
(http://support.microsoft.com/directory/worldwide/zh-cn/community/survey.asp?key=(S,49854782))。