首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > PB >

GetFileSaveName 打开到桌面解决思路

2012-02-22 
GetFileSaveName 打开到桌面rt ,怎样让直接就打开到桌面?[解决办法]//定义结构体global type itemidlist f

GetFileSaveName 打开到桌面
rt ,怎样让直接就打开到桌面?

[解决办法]
//定义结构体
global type itemidlist from structure
longcb
characterabid
end type

//定义外部函数
Function long SHGetSpecialFolderLocation (long hwndOwner,long nFolder , ref ITEMIDLIST pidl ) library "shell32.dll"
Function long SHGetPathFromIDList (long pidl , ref string pszPath) library "shell32.dll" Alias for "SHGetPathFromIDListA;ansi"

//代码
string pathname
ITEMIDLIST IDL 
pathname = Space(512)
SHGetSpecialFolderLocation(100,0,IDL)
SHGetPathFromIDList(IDL.cb, pathname)
messagebox('',pathname)

代码在xp+pb11.5下测试通过,如果是pb10以前版本的需要把后面一个函数声明改一下
Function long SHGetPathFromIDList (long pidl , ref string pszPath) library "shell32.dll" 


调用 GetFileSaveName的时候把初始目录用获得的pathname就可以了

热点排行