Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I am using resource for my update program. i was compile resource with brcc32 than compile updater program. when updater program run its self check everything and write or update with new ones. but about this process you have to right write,delete privileges at where your programs run.</p> <p>i am adding a sample code to below.</p> <p>file exe.rc</p> <pre><code>newprog RCDATA Application.exe </code></pre> <p>file makeres.bat</p> <pre><code>brcc32 exe.rc </code></pre> <p>file updater.dpr</p> <pre><code>{$R exe.res} </code></pre> <p>unit file and procedures</p> <pre><code>procedure ExtractRes(resname,fname,ext:string); var rStream:TResourceStream; fStream:TFileStream; fNamex:string; begin fNamex:=ExtractFilePath(Application.ExeName)+fname+'.'+ext; if not fileExists(fnamex) then begin try rStream:=tresourcestream.Create(hinstance,ResName,RT_rcDATA); fStream := TFileStream.Create(fnamex, fmCreate); fStream.CopyFrom(rStream, 0); finally rStream.Free; fstream.Free; end; end; end; procedure TForm1.Timer1Timer(Sender: TObject); var apath:string; begin if Timer1.Enabled then Timer1.Enabled:=false; apath:=ExtractFilePath(Application.ExeName); lblMesg.Caption:='Backup old version'; Application.ProcessMessages; if FileExists(apath+'Application_old.bak') then DeleteFile(apath+'Application_old.bak') ; while FileExists(apath+'Application.exe') do begin RenameFile(apath + 'Application.exe', apath + 'Application_old.bak'); sleep(1); if FileExists(apath+'Application.exe') then begin lblMesg.Caption:='It seems application still running. Waiting for end'; if FileExists(apath+'Application_old.bak') then DeleteFile(apath+'Application_old.bak'); DeleteFile(apath+'Application.exe'); end; Application.ProcessMessages; end; lblMesg.Caption:='Creating New Version..'; Application.ProcessMessages; ExtractRes('Application','Application','exe'); lblMesg.Caption:='Running New Version...'; Application.ProcessMessages; WinExec(pchar(apath+'Application.exe'),sw_show); Application.ProcessMessages; Halt; end; </code></pre> <p>i think this can help your 1,2,3 question. For 4 you can extend code.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload