int i ;
DWORD dw ;
String^ Source = "c:\\Program\\test.exe" ;
String^ Destination = "c:\\Program Files" ; // move to program Files Folder
//pin_ptr<const wchar_t> WSource = PtrToStringChars(Source);
// pin_ptr<const wchar_t> WDestination = PtrToStringChars(Destination);
i = MoveFileEx(L"c:\\Program Files\\Program\\Test.exe",L"c:\\Program Files",MOVEFILE_REPLACE_EXISTING) ;
dw = GetLastError() ;
return 0;
The status dw is valued as 5 , when i run the program.
Whats the error
Error 5 is Access Denied. This error may occur if
I think you are in the second case: the file you want to overwrite is locked. This it is an executable, it may be running.