您的位置:程序门 -> vb -> 基础类



vb6。0中怎么使用简写的系统路径呢?


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


vb6。0中怎么使用简写的系统路径呢?[已结贴,结贴人:hjx398]
发表于:2007-06-23 14:13:11 楼主
我该怎么使用%temp%  
发表于:2007-06-23 14:32:351楼 得分:20
用api
declare   function   getwindowsdirectory   lib   "kernel32 "   alias   "getwindowsdirectorya "   (byval   lpbuffer   as   string,   byval   nsize   as   long)   as   long

获得系统目录


declare   function   getusername   lib   "advapi32.dll "   alias   "getusernamea "   (byval   lpbuffer   as   string,   nsize   as   long)   as   long

取得用户名,然后进行字符串操作(写一个函数)

private   function   getmytemppath()   as   string
'c:\documents   and   settings\username\local   settings\temp                    
dim   mystring   as   string   *   100
dim   myname   as   string   *   100
dim   namelong   as   long
dim   stringlong   as   long
namelong   =   100
stringlong   =   100


        getwindowsdirectory   mystring,   stringlong
        getusername   myname,   namelong
        getmytemppath   =   mid(mystring,   1,   1)   &   ":\documents   and   settings\ "   &   mid(myname,   1,   namelong   -   1)   &   "\local   settings\temp "

end   function


快速检索

最新资讯
热门点击