本帖最后由 pusofalse 于 2011-10-30 11:59 编辑
Func _CreateMyFile($sFilePath, $iFileSize, $fFailIfExists = 1)
Local $iFlags = ($fFailIfExists = 0) + 1
Local $hFile = DllCall("Kernel32.dll", "handle", "CreateFileW", "wstr", $sFilePath, "dword", 0xC0000000, "dword", 3, "ptr", 0, "dword", $iFlags, "dword", 0, "handle", 0)
$hFile = $hFile[0]
If ($hFile = -1) Then Return SetError(1, 0, 0)
DllCall("Kernel32.dll", "long", "SetFilePointer", "handle", $hFile, "long", $iFileSize, "ptr", 0, "long", 0)
DllCall("Kernel32.dll", "bool", "SetEndOfFile", "handle", $hFile)
DllCall("Kernel32.dll", "bool", "CloseHandle", "handle", $hFile)
Return 1
EndFunc ;==>_CreateMyFile
|