关于调用系统复制文件框的问题.
我发现不能使用中文或者过长的路径,好象是出在 Char 这里了,使用了几个如 int long 等,也都不对,又不知道用何替代,请各位指点一下
_fileCopy("d:\system\系统.iso", "c:\drivers\系统.iso")
Func _filecopy($source, $dest)
Local $SHFILEOPSTRUCT, $source_struct, $dest_struct
$SHFILEOPSTRUCT = DllStructCreate("hwnd hWnd;uint wFunc;ptr pFrom;ptr pTo;int fFlags;int fAnyOperationsAborted;ptr hNameMappings;ptr lpszProgressTitle")
$source_struct = DllStructCreate("char[" & StringLen($source) + 2 & "]")
DllStructSetData($source_struct, 1, $source)
DllStructSetData($source_struct, 1, 0, StringLen($source) + 2)
$dest_struct = DllStructCreate("char[" & StringLen($dest) + 2 & "]")
DllStructSetData($dest_struct, 1, $dest)
DllStructSetData($dest_struct, 1, 0, StringLen($dest) + 2)
DllStructSetData($SHFILEOPSTRUCT, "hWnd", 0)
DllStructSetData($SHFILEOPSTRUCT, "wFunc", 0x0002)
DllStructSetData($SHFILEOPSTRUCT, "pFrom", DllStructGetPtr($source_struct))
DllStructSetData($SHFILEOPSTRUCT, "pTo", DllStructGetPtr($dest_struct))
DllStructSetData($SHFILEOPSTRUCT, "fFlags", 0x0010)
DllCall("shell32.dll", "int", "SHFileOperation", "ptr", DllStructGetPtr($SHFILEOPSTRUCT))
EndFunc
[ 本帖最后由 wyx5 于 2009-2-24 16:20 编辑 ] |