MoveFileEx ()

From ISXKB

Jump to: navigation, search

This article shows how to use the Windows API function MoveFileEx with Inno Setup. Inno Setup's function RestartReplace uses MoveFileEx to queue a file for deletion after the next reboot.

Declaration

The following declaration is required in a [Code] section:

const
   MOVEFILE_REPLACE_EXISTING      = 1;
   MOVEFILE_COPY_ALLOWED          = 2;
   MOVEFILE_DELAY_UNTIL_REBOOT    = 4;
   MOVEFILE_WRITE_THROUGH         = 8;

   // For Windows XP and above.
   MOVEFILE_CREATE_HARDLINK       = 16;
   MOVEFILE_FAIL_IF_NOT_TRACKABLE = 32;

function MoveFileEx (lpExistingFileName, lpNewFileName: PChar, dwFlags: Cardinal): BOOL;
 external 'MoveFileExA@kernel32.dll stdcall';

MoveFileEx () at MSDN

See also

Personal tools
Ads: