Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 1 Woche, 4 Tagen
Letzter Beitrag:
vor 1 Woche, 4 Tagen
Beteiligte Autoren:
Patrick Thijs, Fabrice Harari

I could use some help with CopyFileExA API

Startbeitrag von Patrick Thijs am 05.08.2017 07:54

I'm trying to do a filecopy in a Windev program, where I can display the copy progress with a standard Windev Progressbar.
This should be possible using the API function with CopyFileExA. The WDAPI application shows me the syntax how to do it, but I must be really stupid, because I'm not able to get it running. Mostly because of lack of knowledge from my side I think...

The syntax should be (according to WDAPI)

FunctionReturn is boolean // C type:BOOL
lpExistingFileName is system int // C type:LPCSTR, this is the address of a string, you also have the ability to specify a string directly
lpNewFileName is system int // C type:LPCSTR, this is the address of a string, you also have the ability to specify a string directly
lpProgressRoutine OPTIONAL is LPPROGRESS_ROUTINE //*********** TYPE NOT FOUND ***********
lpData OPTIONAL is system int // C type:LPVOID
pbCancel OPTIONAL is system int // C type:LPBOOL
dwCopyFlags is int // C type:DWORD

FunctionReturn=API("KERNEL32","CopyFileExA",lpExistingFileName,lpNewFileName,lpProgressRoutine OPTIONAL,lpData OPTIONAL,pbCancel OPTIONAL,dwCopyFlags)

For the sourcefile and destination a system int is used, but it should be possible to use a string directly also. But I can't figure out what I have to change in the code.
It would be nice to get the copy working, and then I need to be able the copyprogress with a progressbar. I suppose this has to be done by the lpProgressRoutine. But I don't have any clue on how to do it.

In other words.... HELP !




Hi Patrick,

I've never used this particular api, so what I'm telling you is generic.

AFAIK, a callback function is passed simply by giving the api it's memory address. This seems to be confirmed by the prefix of the variable (lp, which means Long Pointer, ie a SYSTEM INT)

As to how to get the procedure address, &ProcedureName should work.

so doing:
lpProgressRoutine is system int=&ProgressProcedureName

should do the trick. Let us know...

HOWEVER, in case you didn't know, the frProgress option of the fcopyfile wlanguage function already does the work. So except if you want some fancy/specific progressbar, you are wasting your time.

Best regards

von Fabrice Harari - am 05.08.2017 11:25
Hello Fabrice,

thank you for your answer, I will have a look at it.

I know that frProgress option of the fCopyFile command gives a progressbar, but that is a floating window. I want to have my progressbar in my program window without the fancy windows animations ;)



von Patrick Thijs - am 05.08.2017 16:34
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.