Copying

This is a discussion on Copying within the Windows Programming forums, part of the Platform Specific Boards category; How could I make a program (win32) copy itself into a given directery, even if I don't know where the ...

  1. #1
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Posts
    891

    Copying

    How could I make a program (win32) copy itself into a given directery, even if I don't know where the program is?
    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    A running program can always find out where it "is" by calling the GetModuleFileName() API function and passing NULL as the module handle.

    What may be a problem is copying an active program, I don't recall ever trying this, it may be okay. Normally I would use an installer for this kind of thing.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Copying Files
    By ch4 in forum C Programming
    Replies: 8
    Last Post: 02-14-2009, 03:15 PM
  2. Deep and Shallow Copying
    By peckitt99 in forum C++ Programming
    Replies: 4
    Last Post: 08-18-2007, 09:37 PM
  3. Copying a whole directory and its content
    By Enira in forum C Programming
    Replies: 4
    Last Post: 03-12-2006, 01:13 PM
  4. Shallow/Deep copying, pointers
    By littleweseth in forum C++ Programming
    Replies: 3
    Last Post: 11-26-2003, 05:36 PM
  5. Copying a file
    By rkjd2 in forum C++ Programming
    Replies: 5
    Last Post: 09-09-2001, 10:24 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21