如何获得system32的路径?

SKY1006 2004-12-01 02:49:29
如何用VB编写一个程序获得system32的路径
估计要用到API,但不太熟,请各位大侠帮帮忙
...全文
258 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
mingtian2008 2004-12-02
  • 打赏
  • 举报
回复
up
wumylove1234 2004-12-02
  • 打赏
  • 举报
回复
只会VB肯定不行的了.

精一个,熟N个.

数据库,Delphi,C++,C#,VB.Net.......
Yh_King 2004-12-02
  • 打赏
  • 举报
回复
VB是我心中的梦!
我只会VB+数据库,不只有没有发展前途?
yanghong1980924@tom.com
wumylove1234 2004-12-02
  • 打赏
  • 举报
回复
汗,这也行!

VB虽易,精者几何!

有道理.
fog 2004-12-02
  • 打赏
  • 举报
回复
Dim objCnFiles As Object
Set objCnFiles = CreateObject("Scripting.FileSystemObject")
MsgBox objCnFiles.GetSpecialFolder(1)
不知道是不是你要的
jackclh 2004-12-02
  • 打赏
  • 举报
回复
支持dongge2000(秋日私语:非[版务].灌!) 所说!
True1024 2004-12-02
  • 打赏
  • 举报
回复
Option Explicit
Public Const MAX_PATH = 260
Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long

Sub GetSystemDirectory_test()
Dim S As String, Length As Long

S = String(MAX_PATH, 0)
Length = GetSystemDirectory(S, MAX_PATH)
S = Left(S, InStr(S, Chr(0)) - 1)

MsgBox "Windows System 路径=" & S, , "GetSystemDirectory"
End Sub

Sub Main()
GetSystemDirectory_test
End Sub
frankwong 2004-12-01
  • 打赏
  • 举报
回复
Private Sub Form_Load()
MsgBox Environ("systemroot") & "\system32"
End Sub
hwyqy 2004-12-01
  • 打赏
  • 举报
回复
Private Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long

Private Sub Command1_Click()
Dim sTemp As String * 255
dim sPath as string
GetSystemDirectory sTemp , 255
sPath=left(instr(1,sTemp,chr$(0)-1)
End Sub
dongge2000 2004-12-01
  • 打赏
  • 举报
回复
Option Explicit

Public Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Public Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Public Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long

Public Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Public Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long

Public Function WinDir() As String
Dim S As String
Dim Z As Long
Dim R As Long
S = Space(254)
Z = Len(S)
R = GetWindowsDirectory(S, Z)
WinDir = Left(S, R)
WinDir = WinDir & "\"
End Function

Public Function SysDir() As String
Dim S As String
Dim Z As Long
Dim R As Long
S = Space(254)
Z = Len(S)
R = GetSystemDirectory(S, Z)
SysDir = Left(S, R)
SysDir = SysDir & "\"
End Function

Public Function TempDir() As String
Dim S As String
Dim Z As Long
Dim R As Long
S = Space(254)
Z = Len(S)
R = GetTempPath(Z, S)
TempDir = Left(S, R)
End Function

Public Function UserName() As String
Dim S As String
Dim Z As Long
Dim R As Long
S = Space(254)
Z = Len(S)
R = GetUserName(S, Z)
UserName = S
End Function

Public Function ComputerName() As String
Dim S As String
Dim Z As Long
Dim R As Long
S = Space(254)
Z = Len(S)
R = GetComputerName(S, Z)
ComputerName = S
End Function

tztz520 2004-12-01
  • 打赏
  • 举报
回复
Private Sub Form_Load()
MsgBox Environ("systemroot")
End Sub
lxcc 2004-12-01
  • 打赏
  • 举报
回复
Private Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long

Private Sub Command1_Click()
Dim sPath As String * 255
GetSystemDirectory sPath, 255

MsgBox sPath
End Sub

1,216

社区成员

发帖
与我相关
我的任务
社区描述
VB 数据库(包含打印,安装,报表)
社区管理员
  • 数据库(包含打印,安装,报表)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧