2009-08-18 51 views
2

我使用了函數CopyFilea和ShFileOperation。 CopyFileA它複製了文件(龐大的繁瑣數據)。但它沒有顯示覆制進度,並且在SHFileOperation api中嘗試過,這顯示了錯誤。如何通過PB顯示Windows文件複製進度對話框?

PB版本是10.2.0構建7516

錯誤信息:錯誤調用外部函數%S

任何機構請給我一個解決方案嗎?

+2

顯示您的「外部函數聲明」和powerbuilder版本是什麼? – RealHowTo 2009-08-19 01:55:32

+0

Power bUilder版本10.2.0 Build 7516 – 2009-08-19 06:13:22

回答

0

你是什麼操作系統? SHFileOperation已被Windows Vista替換爲IFileOperation

+0

Windows XP,複製進度現在工作正常。 謝謝 – 2009-08-21 10:13:29

2

a discussion of SHFileOperation on sybase.public.powerbuilder.general。此代碼塊顯示瞭如何正確設置結構,在這種情況下進行刪除操作 - 它有幫助嗎?

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 

sybase.public.powerbuilder.general

+0

感謝您的回覆。但它又顯示了相同的錯誤信息 – 2009-08-18 14:43:43