Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

copy a program

Status
Not open for further replies.

Ratster

IS-IT--Management
May 16, 2003
20
0
0
US
hello,
How can I get a program that I've made in win32 copy itself into a different file?
 
Code:
#include <windows.h>

char CopyFrom[MAX_PATH];
char CopyTo[] = &quot;C:\\Anywhere\\You\\Want\\Copy.exe&quot;;
BOOL fOverWriteOK = TRUE; // or FALSE, if you don't want to overwrite

if ( GetModuleFileName ( GetModuleHandle ( NULL ),
                         CopyFrom,
                         sizeof ( CopyFrom )))
   { CopyFile ( CopyFrom, CopyTo,
                fOverWriteOK ? FALSE : TRUE ); }
Marcel
 
Son of a gun!
Thanks Marcel! I was trying to do this for over two weeks now with no luck. I appreciate it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top