VB如何获得安装目录

[复制链接]
查看11 | 回复3 | 2008-10-30 22:46:45 | 显示全部楼层 |阅读模式
有的是C盘,有的是D盘
我想写一个按钮,一点击就可以把
*:\Windows\system32\*.jpg文件的路径直接显示到text1.text去.
最好能写出来,给我复制
因为默认路径是变动的不一定是C盘,所以要要直接获得路径

回复

使用道具 举报

千问 | 2008-10-30 22:46:45 | 显示全部楼层
Private Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long Private Sub Command1_Click() Dim lpBuffer As String, i As Integer lpBuffer = String(255, " ") i = GetWindowsDirectory(lpBuffer, 255) Print Left(lpBuffer, i) '可以设置一个变量来存储这个系统...
回复

使用道具 举报

千问 | 2008-10-30 22:46:45 | 显示全部楼层
楼上太夸张了吧!按照问题的意思很简单的啊!text1.text=*:\Windows\system32\*.jpg不就行了吗??...
回复

使用道具 举报

千问 | 2008-10-30 22:46:45 | 显示全部楼层
1. app.path语句可以获得本程序所在目录2. 获取系统目录, 使用API函数SHGetSpecialFolderLocation和SHGetPathFromIDList函数声明:Private Declare Function SHGetSpecialFolderLocation Lib "Shell32" (ByVal hwndOw...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行