|
2012/1/15(Sun) 00:38:13|NO.44281
newcom WshShell, "WScript.Shell"
path = "%HOMEDRIVE%\\test"
mes WshShell("ExpandEnvironmentStrings", path)
delcom WshShell
;***** ファイル・フォルダの削除 (delfolder.hsp) *****
#module
#define FO_DELETE $00000003
#uselib "shell32.DLL"
#func SHFileOperation "SHFileOperation" int
#deffunc delfolder str prm1,int prm2
sdim sFile,260
sFile = prm1 : if strlen(sFile)==0 : sdim sFile,0 : return -1
nOption = prm2 : if nOption<=0 : nOption=$100
;SHFILEOPSTRUCT構造体
dim pfoStruct,8
pfoStruct(0) = hwnd
pfoStruct(1) = FO_DELETE
pfoStruct(2) = varptr(sFile)
pfoStruct(3) = 0
pfoStruct(4) = nOption
pfoStruct(5) = -1
pfoStruct(6) = 0
pfoStruct(7) = 0
SHFileOperation varptr(pfoStruct)
foStruct=stat
if foStruct!0 {
dialog "ファイル・フォルダの削除に失敗しました。",0,"エラー"
dim pfoStruct,0 : sdim sFile,0
return -1
}
dim pfoStruct,0
return foStruct
#global
delfolder "%HOMEDRIVE%\\test",$4|$10
stop
情報有難うございます
このような記述をしましたがやはり削除できませんでした
|