Results 1 to 6 of 6

Thread: Copy and paste program

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2006
    Posts
    22

    Copy and paste program

    How can i make a copy of my program and paste it in another location??

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Copy and paste program

    If you are talking about a physical disk file, then don't bother with copy 'n paste, just make a copy of it using VB's FileCopy
    VB Code:
    1. FileCopy "c:\fido_glc.exe, "c:\backup\fido_glc.exe"

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Feb 2006
    Posts
    22

    Re: Copy and paste program

    But i don`t know the location of the original prog.
    I think there is a code that gets the original location but don`t know it.

  4. #4
    Hyperactive Member guyvdn's Avatar
    Join Date
    Oct 2002
    Location
    Belgium
    Posts
    336

    Re: Copy and paste program

    App.Path specifies the path of the project .VBP file when running the application from the development environment or the path of the executable file when running the application as an executable file.
    To deny our own impulses is to deny the very thing that makes us human

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Copy and paste program

    Quote Originally Posted by fido_glc
    But i don`t know the location of the original prog.
    I think there is a code that gets the original location but don`t know it.
    Ok. I'm guessing this means that your users could install it anywhere they want to and you have no way of knowing where, right?

    And you need to find out where it is so you can make a backup of it?

    Once, you have the location (and I can show you how to do that providing I'm right about what is going on) do you want to make a special backup folder? Once you know where it is, where do you want to copy it to?

  6. #6
    Hyperactive Member guyvdn's Avatar
    Join Date
    Oct 2002
    Location
    Belgium
    Posts
    336

    Re: Copy and paste program

    Here is some example code to get the path, create a backup folder and copy the exe file (also works if user renames file)

    VB Code:
    1. 'Get the app path
    2.   Dim strPath As String
    3.   strPath = App.Path
    4.   If Right(strPath, 1) <> "\" Then
    5.     strPath = strPath & "\"
    6.   End If
    7.  
    8.   'Make backup folder
    9.   MkDir "c:\Backup\"
    10.  
    11.   'Copy the app exe file
    12.   FileCopy strPath & App.EXEName & ".exe", "c:\Backup\" & App.EXEName & ".exe"
    To deny our own impulses is to deny the very thing that makes us human

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width