Copy app to win dir

This is a discussion on Copy app to win dir within the C Programming forums, part of the General Programming Boards category; How can I copy my app to the windows directory? Any help would be appreciated! I am using Lcc Win32 ...

  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,831
    ?

    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,220
    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,220
    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,220
    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-22-2005, 12:55 AM
  2. how to make a password app for win startup
    By Unregistered in forum Windows Programming
    Replies: 8
    Last Post: 08-20-2002, 12:48 PM
  3. Can I get this to loop back?
    By Unregistered in forum C Programming
    Replies: 9
    Last Post: 05-07-2002, 04:34 AM
  4. Quick ? on copy constructor
    By Traveller in forum C++ Programming
    Replies: 3
    Last Post: 05-03-2002, 11:31 AM
  5. Closing a win app
    By Arias_One in forum C++ Programming
    Replies: 2
    Last Post: 01-25-2002, 09:01 AM

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