利用API创建文件目录

我爱乐乐侠是我

我爱乐乐侠是我

2016-02-19 18:27

今天天气好晴朗处处好风光,好天气好开始,图老师又来和大家分享啦。下面给大家推荐利用API创建文件目录,希望大家看完后也有个好心情,快快行动吧!
PrivateDeclareFunctionCreateDirectoryLib"kernel32"Alias"CreateDirectoryA"(ByVallpPathNameAsString,lpSecurityAttributesAsSECURITY_ATTRIBUTES)AsLong
  
  PrivateTypeSECURITY_ATTRIBUTES
  nLengthAsLong
  lpSecurityDescriptorAsLong
  bInheritHandleAsLong
  EndType
  
  SubMain()
  '在C盘创建了"VB编程乐园"目录
  CallCreateNewDirectory("C:VB编程乐园")
  MsgBox"在C盘创建了VB编程乐园目录"
  EndSub
  
  PublicSubCreateNewDirectory(NewDirectoryAsString)
  DimsDirTestAsString
  DimSecAttribAsSECURITY_ATTRIBUTES
  DimbSuccessAsBoolean
  DimsPathAsString
  DimiCounterAsInteger
  DimsTempDirAsString
  DimiFlagAsInteger
  iFlag=0
  sPath=NewDirectory
  
  IfRight(sPath,Len(sPath))""Then
  sPath=sPath&""
  EndIf
  
  iCounter=1
  DoUntilInStr(iCounter,sPath,"")=0
  iCounter=InStr(iCounter,sPath,"")
  sTempDir=Left(sPath,iCounter)
  sDirTest=Dir(sTempDir)
  iCounter=iCounter 1
  
  '创建目录
  
  SecAttrib.lpSecurityDescriptor=&O0
  SecAttrib.bInheritHandle=False
  SecAttrib.nLength=Len(SecAttrib)
  bSuccess=CreateDirectory(sTempDir,SecAttrib)
  Loop
  EndSub->

展开更多 50%)
分享

猜你喜欢

利用API创建文件目录

编程语言 网络编程
利用API创建文件目录

adobe dreamweaver教程创建文件

Dreamweaver 电脑应用
adobe dreamweaver教程创建文件

s8lol主宰符文怎么配

英雄联盟 网络游戏
s8lol主宰符文怎么配

Excel 批量创建文件夹

文件夹 电脑入门
Excel 批量创建文件夹

Java创建文件夹及文件实例代码

编程语言 网络编程
Java创建文件夹及文件实例代码

lol偷钱流符文搭配推荐

英雄联盟 网络游戏
lol偷钱流符文搭配推荐

excel批量创建新建文件夹?

excel
excel批量创建新建文件夹?

利用API检测文件是否存在

编程语言 网络编程
利用API检测文件是否存在

lolAD刺客新符文搭配推荐

英雄联盟
lolAD刺客新符文搭配推荐

制造出透明的窗体(Form)

制造出透明的窗体(Form)

实现发送多个Ajax请求

实现发送多个Ajax请求
下拉加载更多内容 ↓