Thread: Copy app to win dir

  1. #1
    Unregistered
    Guest

    Question Copy app to win dir

    How can I copy my app to the windows directory?

    Any help would be appreciated!

    I am using Lcc Win32 platform.

  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    ?

    From the OS, use Explorer, from a program, use the CopyFile() API function.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  3. #3
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,212
    Code:
    #include <windows.h>
    
    /* copies self to windows directory */
    
    int main(int argc, char *argv[])
    {
     CopyFile(argv[0],"c:\\windows",0);
     return 0;
    }

  4. #4
    Unregistered
    Guest
    thanks

    how do you do it using WinMain?

  5. #5
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,212
    There's some function to get the app's path. Can't remember it now.

  6. #6
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,212
    Code:
    TCHAR buff[256]; 
    
    GetModuleFileName(NULL,buff,256); 
    CopyFile(buff,"c:\\windows",0);
    tada

  7. #7
    Unregistered
    Guest
    do i need any more include files? cos i cant get it to work!

  8. #8
    Unregistered
    Guest
    works now! lol thanks for the help

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. dynamic memory alloccation & returning objects
    By haditya in forum C++ Programming
    Replies: 8
    Last Post: 04-21-2005, 11:55 PM
  2. how to make a password app for win startup
    By Unregistered in forum Windows Programming
    Replies: 8
    Last Post: 08-20-2002, 11:48 AM
  3. Can I get this to loop back?
    By Unregistered in forum C Programming
    Replies: 9
    Last Post: 05-07-2002, 03:34 AM
  4. Quick ? on copy constructor
    By Traveller in forum C++ Programming
    Replies: 3
    Last Post: 05-03-2002, 10:31 AM
  5. Closing a win app
    By Arias_One in forum C++ Programming
    Replies: 2
    Last Post: 01-25-2002, 09:01 AM