ExtractResourceToFile function
Return to Introduction  Previous page  Next page
Unit
acUtils  

Declaration
function ExtractResourceToFile(Instance: hInst; const ResName, ResType, FileName: String;  
   MarkAsTemporaryFile: Boolean = False): Boolean;  

Description
The ExtractResourceToFile retrieves the resource, specified by ResName and ResType paremters to the FileName.  

Example
// we are using this routine in AutoUpgrader  
procedure TacAutoUpgrader.Relaunch(const ParamStr: String);  
begin  
  // writting Upgrader.exe (self upgrading module)  
  if ExtractResourceToFile(hInstance, UpgraderModuleName, UpgraderModuleName, UpgraderFileName, True) then  
   begin  
    // start self-upgrading mechanism  
    WinExec(PChar(UpgraderFileName + ' ' + Application.ExeName + ' ' + ParamStr), SW_SHOWNORMAL);  
 
    FRestarting := True;          
    if Assigned(FOnDoOwnCloseAppMethod) then  
      FOnDoOwnCloseAppMethod(Self)  
    else  
      ShutdownApplication;  
   end;  
end;  

See also
LoadResourceToStream function.