private declare function gettemppath lib "kernel32" alias "gettemppatha" (byval nbufferlength as long, byval lpbuffer as string) as long ' generate a temporary file (path)\\api????.tmp, where (path) ' is windows's temporary file directory and ???? is a randomly assigned unique value. ' then display the name of the created file on the screen. dim temppath as string ' receives name of temporary file path dim tempfile as string ' receives name of temporary file dim slength as long ' receives length of string returned for the path dim lastfour as long ' receives hex value of the randomly assigned ???? ' get windows's temporary file path temppath = space(255) ' initialize the buffer to receive the path slength = gettemppath(255, temppath) ' read the path name temppath = left(temppath, slength) ' extract data from the variable ' get a uniquely assigned random file tempfile = space(255) ' initialize buffer to receive the filename lastfour = gettempfilename(temppath, "api", 0, tempfile) ' get a unique temporary file name ' (note that the file is also created for you in this case.) tempfile = left(tempfile, instr(tempfile, vbnullchar) - 1) ' extract data from the variable debug.print "temporary filename: "; tempfile
用户登录
还没有账号?立即注册
用户注册
投稿取消
文章分类: |
|
还能输入300字

上传中....