vb获取电脑系统信息_vb如何获取当前文件路径

Private?Declare?Function?GetProcAddress?Lib?"kernel32"?_

(ByVal?hModule?As?Long,?ByVal?lpProcName?As?String)?As?Long

Private?Declare?Function?GetModuleHandle?Lib?"kernel32"?_

Alias?"GetModuleHandleA"(ByVal?lpModuleName?As?String)?As?Long

Private?Declare?Function?GetCurrentProcess?Lib?"kernel32"?()?As?Long

Private?Declare?Function?IsWow64Process?Lib?"kernel32"?_

(ByVal?hProc?As?Long,bWow64Process?As?Boolean)?As?Long

Public?Function?Is64bit()?As?Boolean

Dim?handle?As?Long,?bolFunc?As?Boolean

'?Assume?initially?that?this?is?not?a?Wow64?process

bolFunc?=?False

'?Now?check?to?see?if?IsWow64Process?function?exists

handle?=?GetProcAddress(GetModuleHandle("kernel32"),?_

"IsWow64Process")

If?handle?>?0?Then?'?IsWow64Process?function?exists

'?Now?use?the?function?to?determine?if?

'?we?are?running?under?Wow64

IsWow64Process?GetCurrentProcess(),?bolFunc

End?If

Is64bit?=?bolFunc

End?Function

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

Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long

Private Sub GetName()

Dim sJM As String

Dim sMC As String

Dim sIP As String

Dim s As String

s = String(128, Chr(0))

GetComputerName s, Len(s)

s = UCase(Left(s, InStr(1, s, Chr(0)) - 1))

sJM = s'计算机名称

s = String(128, Chr(0))

GetUserName s, Len(s)

s = UCase(Left(s, InStr(1, s, Chr(0)) - 1))

sMC = s‘当前用户名称

End Sub

'用这种方法在远程获得再发回本机就可以吧

'取计算机型号暂时不会