如何VB获得桌面所在路径?
8个回答
展开全部
Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpbuffer As String, nSize As Long) As Long
Private Sub Form_Load()
Dim sBuffer As String
Dim lSize As Long
sBuffer = Space$(255)
lSize = Len(sBuffer)
Call GetUserName(sBuffer, lSize)
Dim A As String
If lSize > 0 Then
A = Left$(sBuffer, lSize)
A = Left(A, Len(A) - 1)
MsgBox "c:\Documents and settings\" & A & "\桌面\"
Else
A = vbNullString
End If
End Sub
Private Sub Form_Load()
Dim sBuffer As String
Dim lSize As Long
sBuffer = Space$(255)
lSize = Len(sBuffer)
Call GetUserName(sBuffer, lSize)
Dim A As String
If lSize > 0 Then
A = Left$(sBuffer, lSize)
A = Left(A, Len(A) - 1)
MsgBox "c:\Documents and settings\" & A & "\桌面\"
Else
A = vbNullString
End If
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
首先在工程的引用中选中Windows Scripting Host Object Model
Private Sub Form_Load()
Dim desk As New WshShell
MsgBox desk.SpecialFolders("desktop")
End Sub
Private Sub Form_Load()
Dim desk As New WshShell
MsgBox desk.SpecialFolders("desktop")
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
要先在 工程-引用中添加 windows script host object model
Dim kk As New IWshRuntimeLibrary.IWshShell_Class
text1.text= kk.SpecialFolders("Desktop")
Dim kk As New IWshRuntimeLibrary.IWshShell_Class
text1.text= kk.SpecialFolders("Desktop")
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
vb我不会,要是单纯想获得桌面路径,在这里
%USERPROFILE%\桌面
%USERPROFILE%\桌面
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询