CopyFileEx API call

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Insomniac.

Hi all,

I'm wanting to copy a file using the CopyFileEx API command and update a progress bar using the CopyprogressRoutine that it calls (every 64k I've read).

Does anyone have a working code snippet for this API or can help by correcting my code below?

I've not used structures with procedure calls before. At present the debug code causes a "pointer is null" error.

I have found that changing the LARGE_INTEGER structures to long (.l) allows the code to run but after the final call to the copyprogress procedure the code loops with the processor at 99 percent until I quit.

Thx.:)
Insomniac

Procedure.l CopyProgress( *TotalFileSize.LARGE_INTEGER, *TotalBytesTransferred.LARGE_INTEGER, *StreamSize.LARGE_INTEGER, *StreamBytesTransferred.LARGE_INTEGER, dwStreamNumber.l, dwCallbackReason.l , hSourceFile.l , hDestinationFile.l , lpData.l )

; This procedure will be expanded to drive a progressbar gadget

Debug *TotalBytesTransferred\lowpart
Debug *TotalBytesTransferred\highpart

ProcedureReturn 0
EndProcedure

sourcefile.s = "c:\temp\a.txt"
destfile.s = "c:\temp\b.txt"

lpData.l = NULL ; Nothing to be passed To the callback function

pbCancel.l = #FALSE; flag that can be used To cancel the operation

dwCopyFlags.l = 0 ; flags that specify how the file is copied

MsgBuffer.s = Space(200)

Result = CopyFileEx_( @sourcefile, @destfile, @CopyProgress() , lpData, pbCancel, dwCopyFlags)

If result = 0
FormatMessage_(#FORMAT_MESSAGE_FROM_SYSTEM, 0, GetLastError_(), #LANG_NEUTRAL, @MsgBuffer, 200, 0)
MessageRequester("",MsgBuffer,#PB_MessageRequester_Ok)
Else
MessageRequester("demo","Success", #PB_MessageRequester_Ok )
EndIf
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by blueb.

I was going to suggest doing a 'search' and looking for a small program I had on the forum last November... but I couldn't locate it!

so here's a small sample that uses the SHCopy API. Perhaps you can modify it for CopyFileEx.

Code: Select all

;======================================================================
;   ShareCopy.PB -  A Muli-Function Copy Tool that uses: Shell32.dll
;                   I found a subroutine on VB web-site -  author unknown
;                   modified for PureBasic -  Public Domain
;                   Bob Houle - updated Nov 02/02    [url]mailto:blueb@shaw.ca[/url]
;======================================================================
#Window1 = 1
#W1Btn1 = 1
#W1Btn2 = 2
#W1Btn3 = 3
#W1Btn4 = 4
#W1Btn5 = 5
#W1String1 = 6
#W1String2 = 7
#W1Check1 = 8
#W1Check2 = 9
#W1Check3 = 10
#W1Check4 = 11
#W1Check5 = 12
#W1Text1 = 13
#W1Text2 = 14

#Window1Flags = #PB_Window_MinimizeGadget | #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_WindowCentered 
#Text1Flags = #PB_Text_Right
#Text2Flags = #PB_Text_Right

;======================================================================
;                [ Declares ]
;======================================================================
Declare MyWindowCallback(WindowID, Message, wParam, lParam)
Declare Button_Click(Index.l)

;======================================================================
;                [ Globals ]
;======================================================================
Global SHFileOp.SHFILEOPSTRUCT    ;Windows API Structure

;========================================================================================

WinW=500
WinH=230 ; Window sizes.

hWnd.l = OpenWindow(#Window1,0,0,WinW,WinH,#Window1Flags,"Window-Like File Operations")
 If CreateGadgetList(WindowID(1))
   ButtonGadget(#W1Btn1,7,200 ,89,25,"Copy")
   ButtonGadget(#W1Btn2,105,200 ,89,25,"Move")
   ButtonGadget(#W1Btn3,205,200 ,89,25,"Rename")
   ButtonGadget(#W1Btn4,305,200 ,89,25,"Delete")
   ButtonGadget(#W1Btn5,405,200 ,89,25,"Quit", 1)
   StringGadget(#W1String1,220,8,250,21,"")
   StringGadget(#W1String2,220,30 ,250,21,"")
   CheckBoxGadget(#W1Check1,90,80 ,391,17,"Don't display a progress dialog box")
   CheckBoxGadget(#W1Check2,90,100 ,403,17,"Respond with 'Yes to all' for any dialog box that is displayed")
   CheckBoxGadget(#W1Check3,90,120 ,404,17,"Rename the file (eg:'Copy #1 of...') if the target name already exists")
   CheckBoxGadget(#W1Check4,90,140 ,384,17,"Do not confirm the creation of a new directory if the operation requires it")
   CheckBoxGadget(#W1Check5,90,160 ,398,17,"Perform the operation only on files if a wildcard filename (*.*) is specified")
   TextGadget(#W1Text1,50,12 ,161,17,"Source File or Folder", #Text1Flags)
   TextGadget(#W1Text2,50,35,161,17,"Destination File or Folder", #Text2Flags)
 EndIf
 
If hWnd 
;Message Loop

; ----- Windows Messages
  ; Callback is not required for this App, but included anyways :)
  ; Might want to reply to Windows messages.
  ; For now simply try re-sizing the window
  SetWindowCallback(@MyWindowCallback())
  
; ----- PB specific messages
 Repeat
   EventID.l = WaitWindowEvent()

  Select EventID

          Case #PB_EventGadget

              Select EventGadgetID()
               Case #W1Btn1 ;----------Copy
                    Button_Click(0)
               Case #W1Btn2 ;----------Move
                    Button_Click(1)
               Case #W1Btn3 ;----------Rename
                    Button_Click(2)
               Case #W1Btn4 ;----------Delete
                    Button_Click(3)
               Case #W1Btn5 ;----------Quit
                      EventID = #PB_EventCloseWindow
              EndSelect

  EndSelect

 Until EventID = #PB_EventCloseWindow

EndIf
End ; program finish

; *********************************************************************
;                [ Required Procedures ]
; *********************************************************************


;======================================================================
;                [ Callback Procedure ]
;======================================================================
Procedure MyWindowCallback(WindowID, Message, wParam, lParam) 
  Result = #PB_ProcessPureBasicEvents 
    Select message 
          Case #WM_SIZE    ;just testing
              beep_(50,50) 
    EndSelect 
  ProcedureReturn Result 
EndProcedure 

;======================================================================
;                [ SHFileOperation API Procedure ]
;======================================================================
Procedure.l Button_Click(Index.l)

;define variables
 lFileOp.f
 lresult.l
 lFlags.w

;Get status of checkboxes
ChkDir.l = GetGadgetState(#W1Check4) 
ChkFilesOnly.l = GetGadgetState(#W1Check5) 
ChkRename.l = GetGadgetState(#W1Check3) 
ChkSilent.l = GetGadgetState(#W1Check1) 
ChkYesToAll.l = GetGadgetState(#W1Check2)  

;Get the edit box values
FromDirectory.s = GetGadgetText(#W1String1) 
ToDirectory.s = GetGadgetText(#W1String2)

;Find out which button was pressed 
 Select Index
    Case 0
        lFileOp = #FO_COPY
    Case 1
        lFileOp = #FO_MOVE
    Case 2
        lFileOp = #FO_RENAME
    Case 3
         ChkYesToAll = 0      ;No mattter what - confirm Deletes! Prevents OOPS!
         lFileOp = #FO_DELETE
 EndSelect

If ChkSilent:lFlags = lFlags | #FOF_SILENT: EndIf
If ChkYesToAll: lFlags = lFlags | #FOF_NOCONFIRMATION:EndIf
If ChkRename: lFlags = lFlags | #FOF_RENAMEONCOLLISION: EndIf
If ChkDir: lFlags = lFlags | #FOF_NOCONFIRMMKDIR: EndIf
If ChkFilesOnly: lFlags = lFlags | #FOF_FILESONLY: EndIf

; NOTE:  If you add the #FOF_ALLOWUNDO Flag you can move
;        a file to the Recycle Bin instead of deleting it.

  SHFileOp\wFunc = lFileOp
  SHFileOp\pFrom = @FromDirectory
  SHFileOp\pTo = @ToDirectory 
  SHFileOp\fFlags = lFlags

 lresult = SHFileOperation_(SHFileOp)

;  If User hit Cancel button While operation is in progress,
;  the fAnyOperationsAborted parameter will be true
;  - see win32api.inc For Structure details.

If lresult  0 | SHFileOp\fAnyOperationsAborted:EndIf: ProcedureReturn 0

 MessageRequester("Operation Has Completed", "PureBasic Rules!", 0)
  ProcedureReturn = lresult
EndProcedure
; ================================================================
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Insomniac.

Thanks that's a great example and I will definitely explore it further.

However, I really want to draw the progess bar myself and not use the "canned' windows one.

When I had succeeded in getting one copy to work I was wanting to multithread the copy and perhaps use Justin's "Progress bar inside listicon" code for multiple progress bars.

In my work I often have to copy files to multiple remote machines and writing batch files for Microsoft's Robocopy utility ( which uses CopyFileEx ) has lost it's appeal over the years.

There is a VB example of this API here if it's of help http://www.codenotes.com/do/articles/ar ... icleID=507

Insomniac - Registered PB User
gonpublic2k
User
User
Posts: 40
Joined: Mon Oct 14, 2019 1:38 am

Re:

Post by gonpublic2k »

BackupUser wrote:Restored from previous forum. Originally posted by blueb.

I was going to suggest doing a 'search' and looking for a small program I had on the forum last November... but I couldn't locate it!

so here's a small sample that uses the SHCopy API. Perhaps you can modify it for CopyFileEx.

Code: Select all

;======================================================================
;   ShareCopy.PB -  A Muli-Function Copy Tool that uses: Shell32.dll
;                   I found a subroutine on VB web-site -  author unknown
;                   modified for PureBasic -  Public Domain
;                   Bob Houle - updated Nov 02/02    [url]mailto:blueb@shaw.ca[/url]
;======================================================================
#Window1 = 1
#W1Btn1 = 1
#W1Btn2 = 2
#W1Btn3 = 3
#W1Btn4 = 4
#W1Btn5 = 5
#W1String1 = 6
#W1String2 = 7
#W1Check1 = 8
#W1Check2 = 9
#W1Check3 = 10
#W1Check4 = 11
#W1Check5 = 12
#W1Text1 = 13
#W1Text2 = 14

#Window1Flags = #PB_Window_MinimizeGadget | #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_WindowCentered 
#Text1Flags = #PB_Text_Right
#Text2Flags = #PB_Text_Right

;======================================================================
;                [ Declares ]
;======================================================================
Declare MyWindowCallback(WindowID, Message, wParam, lParam)
Declare Button_Click(Index.l)

;======================================================================
;                [ Globals ]
;======================================================================
Global SHFileOp.SHFILEOPSTRUCT    ;Windows API Structure

;========================================================================================

WinW=500
WinH=230 ; Window sizes.

hWnd.l = OpenWindow(#Window1,0,0,WinW,WinH,#Window1Flags,"Window-Like File Operations")
 If CreateGadgetList(WindowID(1))
   ButtonGadget(#W1Btn1,7,200 ,89,25,"Copy")
   ButtonGadget(#W1Btn2,105,200 ,89,25,"Move")
   ButtonGadget(#W1Btn3,205,200 ,89,25,"Rename")
   ButtonGadget(#W1Btn4,305,200 ,89,25,"Delete")
   ButtonGadget(#W1Btn5,405,200 ,89,25,"Quit", 1)
   StringGadget(#W1String1,220,8,250,21,"")
   StringGadget(#W1String2,220,30 ,250,21,"")
   CheckBoxGadget(#W1Check1,90,80 ,391,17,"Don't display a progress dialog box")
   CheckBoxGadget(#W1Check2,90,100 ,403,17,"Respond with 'Yes to all' for any dialog box that is displayed")
   CheckBoxGadget(#W1Check3,90,120 ,404,17,"Rename the file (eg:'Copy #1 of...') if the target name already exists")
   CheckBoxGadget(#W1Check4,90,140 ,384,17,"Do not confirm the creation of a new directory if the operation requires it")
   CheckBoxGadget(#W1Check5,90,160 ,398,17,"Perform the operation only on files if a wildcard filename (*.*) is specified")
   TextGadget(#W1Text1,50,12 ,161,17,"Source File or Folder", #Text1Flags)
   TextGadget(#W1Text2,50,35,161,17,"Destination File or Folder", #Text2Flags)
 EndIf
 
If hWnd 
;Message Loop

; ----- Windows Messages
  ; Callback is not required for this App, but included anyways :)
  ; Might want to reply to Windows messages.
  ; For now simply try re-sizing the window
  SetWindowCallback(@MyWindowCallback())
  
; ----- PB specific messages
 Repeat
   EventID.l = WaitWindowEvent()

  Select EventID

          Case #PB_EventGadget

              Select EventGadgetID()
               Case #W1Btn1 ;----------Copy
                    Button_Click(0)
               Case #W1Btn2 ;----------Move
                    Button_Click(1)
               Case #W1Btn3 ;----------Rename
                    Button_Click(2)
               Case #W1Btn4 ;----------Delete
                    Button_Click(3)
               Case #W1Btn5 ;----------Quit
                      EventID = #PB_EventCloseWindow
              EndSelect

  EndSelect

 Until EventID = #PB_EventCloseWindow

EndIf
End ; program finish

; *********************************************************************
;                [ Required Procedures ]
; *********************************************************************


;======================================================================
;                [ Callback Procedure ]
;======================================================================
Procedure MyWindowCallback(WindowID, Message, wParam, lParam) 
  Result = #PB_ProcessPureBasicEvents 
    Select message 
          Case #WM_SIZE    ;just testing
              beep_(50,50) 
    EndSelect 
  ProcedureReturn Result 
EndProcedure 

;======================================================================
;                [ SHFileOperation API Procedure ]
;======================================================================
Procedure.l Button_Click(Index.l)

;define variables
 lFileOp.f
 lresult.l
 lFlags.w

;Get status of checkboxes
ChkDir.l = GetGadgetState(#W1Check4) 
ChkFilesOnly.l = GetGadgetState(#W1Check5) 
ChkRename.l = GetGadgetState(#W1Check3) 
ChkSilent.l = GetGadgetState(#W1Check1) 
ChkYesToAll.l = GetGadgetState(#W1Check2)  

;Get the edit box values
FromDirectory.s = GetGadgetText(#W1String1) 
ToDirectory.s = GetGadgetText(#W1String2)

;Find out which button was pressed 
 Select Index
    Case 0
        lFileOp = #FO_COPY
    Case 1
        lFileOp = #FO_MOVE
    Case 2
        lFileOp = #FO_RENAME
    Case 3
         ChkYesToAll = 0      ;No mattter what - confirm Deletes! Prevents OOPS!
         lFileOp = #FO_DELETE
 EndSelect

If ChkSilent:lFlags = lFlags | #FOF_SILENT: EndIf
If ChkYesToAll: lFlags = lFlags | #FOF_NOCONFIRMATION:EndIf
If ChkRename: lFlags = lFlags | #FOF_RENAMEONCOLLISION: EndIf
If ChkDir: lFlags = lFlags | #FOF_NOCONFIRMMKDIR: EndIf
If ChkFilesOnly: lFlags = lFlags | #FOF_FILESONLY: EndIf

; NOTE:  If you add the #FOF_ALLOWUNDO Flag you can move
;        a file to the Recycle Bin instead of deleting it.

  SHFileOp\wFunc = lFileOp
  SHFileOp\pFrom = @FromDirectory
  SHFileOp\pTo = @ToDirectory 
  SHFileOp\fFlags = lFlags

 lresult = SHFileOperation_(SHFileOp)

;  If User hit Cancel button While operation is in progress,
;  the fAnyOperationsAborted parameter will be true
;  - see win32api.inc For Structure details.

If lresult  0 | SHFileOp\fAnyOperationsAborted:EndIf: ProcedureReturn 0

 MessageRequester("Operation Has Completed", "PureBasic Rules!", 0)
  ProcedureReturn = lresult
EndProcedure
; ================================================================
Hi, very good example, however I get the following error when I try to compile this:

Image

Any ideas why? How to correct ti so I can compile? Thanks!!
infratec
Always Here
Always Here
Posts: 7595
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: CopyFileEx API call

Post by infratec »

If you read ther erropr message, you get the answer.
The parameters are not correct.
I think they changed fro this very very old version to the newer versions.
Simply read the help or check the parametsr in the status line of the IDE when you place the cursor
on each prameter.
gonpublic2k
User
User
Posts: 40
Joined: Mon Oct 14, 2019 1:38 am

Re: CopyFileEx API call

Post by gonpublic2k »

infratec wrote:If you read ther erropr message, you get the answer.
The parameters are not correct.
I think they changed fro this very very old version to the newer versions.
Simply read the help or check the parametsr in the status line of the IDE when you place the cursor
on each prameter.
Ok, thanks for the quick reply, however I'm new to PB and I don't know exactly how to correct
this error. Perhaps you can enlighteh me and show me a sample?
infratec
Always Here
Always Here
Posts: 7595
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: CopyFileEx API call

Post by infratec »

Code: Select all

OpenWindow(#Window1, 0, 0, WinW, WinH, "Window-Like File Operations", #Window1Flags)
infratec
Always Here
Always Here
Posts: 7595
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: CopyFileEx API call

Post by infratec »

As I told you: look at the status line of the IDE when you place the cursor on a parameter, then you see what's expected.
gonpublic2k
User
User
Posts: 40
Joined: Mon Oct 14, 2019 1:38 am

Re: CopyFileEx API call

Post by gonpublic2k »

infratec wrote:As I told you: look at the status line of the IDE when you place the cursor on a parameter, then you see what's expected.
Great, thanks for your help!
gonpublic2k
User
User
Posts: 40
Joined: Mon Oct 14, 2019 1:38 am

Re: CopyFileEx API call

Post by gonpublic2k »

Well, perhaps I don't know if this whole code is very outdated but even after putting in your correction
I get another error now. This is frustrating :(

Image
photo sharing

Does anyone have this same code updated for PB v5.70 ?
User avatar
mk-soft
Always Here
Always Here
Posts: 6224
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: CopyFileEx API call

Post by mk-soft »

Tipp-Error ".1" -> ".l"

Besser use .i for Integer (X64/X86)
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
gonpublic2k
User
User
Posts: 40
Joined: Mon Oct 14, 2019 1:38 am

Re: CopyFileEx API call

Post by gonpublic2k »

mk-soft wrote:Tipp-Error ".1" -> ".l"

Besser use .i for Integer (X64/X86)

Thanks, after that correction I still get another error message:

Image
User avatar
Lord
Addict
Addict
Posts: 901
Joined: Tue May 26, 2009 2:11 pm

Re: CopyFileEx API call

Post by Lord »

First: the name convention for #PB_EventGadget has changed to #PB_Event_Gadget
After you changed that you will get another error:
EventGadgetID() has changed to EventGadget().

Just look into the help for each error you get. That it is for. :wink:
Image
gonpublic2k
User
User
Posts: 40
Joined: Mon Oct 14, 2019 1:38 am

Re: CopyFileEx API call

Post by gonpublic2k »

Lord wrote:First: the name convention for #PB_EventGadget has changed to #PB_Event_Gadget
After you changed that you will get another error:
EventGadgetID() has changed to EventGadget().

Just look into the help for each error you get. That it is for. :wink:
Perhaps if you could just convert this entire script to be compatible with v5.70 and help me out,
I've tried all of the suggestions and it seems it fixes one thing but complaints on another part of
the script. I'm exhausted :(

Appreciate all of your help!!

Image
subir foto para foro
infratec
Always Here
Always Here
Posts: 7595
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: CopyFileEx API call

Post by infratec »

Programming is not copy and paste :wink:

Code: Select all

EnableExplicit

;======================================================================
;   ShareCopy.PB -  A Muli-Function Copy Tool that uses: Shell32.dll
;                   I found a subroutine on VB web-site -  author unknown
;                   modified for PureBasic -  Public Domain
;                   Bob Houle - updated Nov 02/02    [url]mailto:blueb@shaw.ca[/url]
;======================================================================
#Window1 = 1
#Btn_Copy = 1
#Btn_Move = 2
#Btn_Rename = 3
#Btn_Delete = 4
#Btn_Quit = 5
#W1String1 = 6
#W1String2 = 7
#W1Check1 = 8
#W1Check2 = 9
#W1Check3 = 10
#W1Check4 = 11
#W1Check5 = 12
#W1Text1 = 13
#W1Text2 = 14

#Window1Flags = #PB_Window_MinimizeGadget | #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_ScreenCentered



Procedure.i Button_Click(Index.i)
  
  ;define variables
  Protected wFunc.u
  Protected lresult.l
  Protected fFlags.u
  Protected.i ChkDir, ChkFilesOnly, ChkRename, ChkSilent,ChkYesToAll
  Protected FromDirectory$, ToDirectory$
  Protected SHFileOp.SHFILEOPSTRUCT    ;Windows API Structure
  
  ;Get status of checkboxes
  ChkDir = GetGadgetState(#W1Check4)
  ChkFilesOnly = GetGadgetState(#W1Check5)
  ChkRename = GetGadgetState(#W1Check3)
  ChkSilent = GetGadgetState(#W1Check1)
  ChkYesToAll = GetGadgetState(#W1Check2)
  
  ;Get the edit box values
  FromDirectory$ = GetGadgetText(#W1String1)
  ToDirectory$ = GetGadgetText(#W1String2)
  
  ;Find out which button was pressed
  Select Index
    Case #Btn_Copy
      wFunc = #FO_COPY
    Case #Btn_Move
      wFunc = #FO_MOVE
    Case #Btn_Rename
      wFunc = #FO_RENAME
    Case #Btn_Delete
      ChkYesToAll = 0      ;No mattter what - confirm Deletes! Prevents OOPS!
      wFunc = #FO_DELETE
  EndSelect
  
  If ChkSilent
    fFlags | #FOF_SILENT
  EndIf
  If ChkYesToAll
    fFlags | #FOF_NOCONFIRMATION
  EndIf
  If ChkRename
    fFlags | #FOF_RENAMEONCOLLISION
  EndIf
  If ChkDir
    fFlags | #FOF_NOCONFIRMMKDIR
  EndIf
  If ChkFilesOnly
    fFlags | #FOF_FILESONLY
  EndIf
  
  ; NOTE:  If you add the #FOF_ALLOWUNDO Flag you can move
  ;        a file to the Recycle Bin instead of deleting it.
  
  SHFileOp\wFunc = wFunc
  SHFileOp\pFrom = @FromDirectory$
  SHFileOp\pTo = @ToDirectory$
  SHFileOp\fFlags = fFlags
  
  lresult = SHFileOperation_(SHFileOp)
  
  ;  If User hit Cancel button While operation is in progress,
  ;  the fAnyOperationsAborted parameter will be true
  ;  - see win32api.inc For Structure details.
  
  If lresult = 0 Or SHFileOp\fAnyOperationsAborted
    ProcedureReturn 0
  EndIf
  
  MessageRequester("Operation Has Completed", "PureBasic Rules!", 0)
  
  ProcedureReturn lresult
  
EndProcedure



Define.i Event

If OpenWindow(#Window1, 0, 0, 500, 230, "Window-Like File Operations", #Window1Flags)
  
  ButtonGadget(#Btn_Copy,7,200 ,89,25,"Copy")
  ButtonGadget(#Btn_Move,105,200 ,89,25,"Move")
  ButtonGadget(#Btn_Rename,205,200 ,89,25,"Rename")
  ButtonGadget(#Btn_Delete,305,200 ,89,25,"Delete")
  ButtonGadget(#Btn_Quit,405,200 ,89,25,"Quit", 1)
  StringGadget(#W1String1,220,8,250,21,"")
  StringGadget(#W1String2,220,30 ,250,21,"")
  CheckBoxGadget(#W1Check1,90,80 ,391,17,"Don't display a progress dialog box")
  CheckBoxGadget(#W1Check2,90,100 ,403,17,"Respond with 'Yes to all' for any dialog box that is displayed")
  CheckBoxGadget(#W1Check3,90,120 ,404,17,"Rename the file (eg:'Copy #1 of...') if the target name already exists")
  CheckBoxGadget(#W1Check4,90,140 ,384,17,"Do not confirm the creation of a new directory if the operation requires it")
  CheckBoxGadget(#W1Check5,90,160 ,398,17,"Perform the operation only on files if a wildcard filename (*.*) is specified")
  TextGadget(#W1Text1,50,12 ,161,17,"Source File or Folder", #PB_Text_Right)
  TextGadget(#W1Text2,50,35,161,17,"Destination File or Folder", #PB_Text_Right)
  
  Repeat
    Event = WaitWindowEvent()
    
    Select Event
        
      Case #PB_Event_Gadget
        
        Select EventGadget()
          Case #Btn_Copy
            Button_Click(#Btn_Copy)
          Case #Btn_Move
            Button_Click(#Btn_Move)
          Case #Btn_Rename
            Button_Click(#Btn_Rename)
          Case #Btn_Delete
            Button_Click(#Btn_Delete)
          Case #Btn_Quit
            Event = #PB_Event_CloseWindow
        EndSelect
        
    EndSelect
    
  Until Event = #PB_Event_CloseWindow
  
EndIf
It compiles now and is starting, but I have not tested it.

But I think it is really outdated.
So it would be better if you tell us what you want to do, or to have
Last edited by infratec on Sun Nov 17, 2019 7:07 pm, edited 2 times in total.
Post Reply