home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.pascal.borland      Borland Pascal was actually pretty neat      2,978 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 1,918 of 2,978   
   Femme Verbeek to All   
   Re: Check for locked file in TP   
   09 Oct 05 22:59:32   
   
   From: fv@tcenl.nospam.com   
      
   In the obscure news:1128848318.121341.230490@f14g2000cwb.googlegroups.com,   
    Someone calling himself Wim   
    suspiciously hiding as  uttered:   
   > The wording used in the original question is perhaps misleading. The   
   > program "crashing" means that despite all checks the intended I/O   
   > operation fails. As it is an installer, it uninstalls everything   
   > already installed and stops with an error message. The cause is a   
   > virusscanner, thus the file is only for a short time unavailable.   
      
      
   Why do you think that waiting will unlock the files?   
      
   If it is the virusscanner causing trouble, I would advice the customer to   
   temporarily   
   disable it.   
      
   Anyway,   
   this does not change my answer (much).   
   Do your IO operation, and check the value of IOresult. See the TP help file   
   under runtime   
   error messages for the expected values. If there is no error detected, while   
   still failing   
   to do the operation, there is something very crooked in the operating system   
      
   In order to make the waiting routine, check out my time poller below.   
   On first call a value is assigned to the starttime var. As long as the   
   duration has not   
   expired, the function returns false. After expiration a new starttime value is   
   assigned and   
   the function returns true. You can have as many parallel running timers as you   
   want.   
   Duration is in 1/100 s, but that can easily be changed by modifying the Now   
   calculation.   
      
   --   
   Femme Verbeek   
      
      
      
   uses crt,dos;   
      
   procedure yield; {in order to freeup processor time when idle}   
   var    regs: registers;   
   begin   
     regs.AX := $1680;   
     Intr($2F,regs);   
   end;   
      
   function checktime(var starttime:longint;duration:longint):boolean;   
   var h, m, s, hund : Word;   
   var now:longint;   
   begin   
     GetTime(h,m,s,hund);   
     now:= longint(hund)+100*(longint(s)+60*(longint(m)+60*longint(h)));   
     if  now < starttime then inc(now,8640000); {passed the 24 hour border}   
     if (now >= starttime+duration) then   
       begin   
         checktime:=true;   
         starttime:=now;   
         if (starttime>8640000) then dec(starttime,8640000);   
       end   
       else checktime:=false;   
   end;   
      
      
   const time1:longint=0;   
         time2:longint=0;   
   begin   
     repeat   
        if checktime(time1,50) then write('Hello ');   
        if checktime(time2,87) then writeln('World');   
        yield;   
     until keypressed;   
     while keypressed do readkey;   
   end.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca