我使用了函数 CopyFilea 和 ShFileOperation。CopyFileA 它复制了文件(大而繁琐的数据)。但它没有显示复制进度,并且在 SHFileOperation api 中也尝试过,这显示了错误。
PB 版本为 10.2.0 build 7516
错误消息:调用外部函数 %s 时出错
任何机构请给我一个解决方案?
我使用了函数 CopyFilea 和 ShFileOperation。CopyFileA 它复制了文件(大而繁琐的数据)。但它没有显示复制进度,并且在 SHFileOperation api 中也尝试过,这显示了错误。
PB 版本为 10.2.0 build 7516
错误消息:调用外部函数 %s 时出错
任何机构请给我一个解决方案?
在sybase.public.powerbuilder.general 上讨论了 SHFileOperation。此代码块显示了如何正确设置结构,在这种情况下进行删除操作 - 有帮助吗?
type os_shfileopstruct from structure
unsignedlong hwnd
unsignedlong wfunc
blob pfrom
blob pto
unsignedinteger fflags
unsignedlong banyoperationsaborted
unsignedlong hnamemappings
string lpszprogresstitle
end type
//inside a function call:
// Arguments: as_SourceFile - the file(s) to delete.
// aui_flags - file operation flags (0 - default)
// aw_requestor - the requesting window
os_shfileopstruct lstr_FileOp
Integer li_rc
lstr_FileOp.hWnd = Handle(aw_requestor)
lstr_FileOp.wFunc = FO_DELETE
lstr_FileOp.pFrom = Blob( as_SourceFile + Space(2) )
BlobEdit( lstr_FileOp.pFrom, Len( as_sourcefile ) + 1, Char(0) )
BlobEdit( lstr_FileOp.pFrom, Len( as_sourcefile ) + 2, Char(0) )
lstr_FileOp.fFlags = aui_flags
lstr_FileOp.hNameMappings = 0
lstr_FileOp.lpszProgressTitle = Space(10)
li_rc = SHFileOperationA( lstr_FileOp )
IF li_rc <> 0 THEN
IF NOT IsNull( lstr_FileOp ) THEN
IF lstr_FileOp.bAnyOperationsAborted = 1 THEN
RETURN 0
END IF
END IF
ELSE
-1
END IF
RETURN 1
你的操作系统是什么? SHFileOperation在 Windows Vista 中已被IFileOperation 替换。