TIP: Click on subject to list as thread! ANSI
echo: delphi
to: STEVE BATSON
from: GARY WEINFURTHER
date: 1997-03-09 08:53:00
subject: Works in D1 but not D2

Steve Batson mentioned this to All:
 SB>    If (CharByte0) or (CharByte32) then
 SB>       begin
 SB>       CharByte:=CharByte xor Ord(Key[Ctr]);
 SB>       FBuffer[x]:=CharByte;
 SB>       end;
 SB>    If (CharByte=0) or (CharByte=32) then
 SB>       CharByte:=CharByte xor Ord(Key[Ctr]);
 SB>    If Ctr>KeyLen then
 SB>       Ctr:=0;
 SB>    Application.ProcessMessages;
The first line will always evaluate to true.  And you are executing the same 
statement in either of your cases.
Try the following:
  CharByte := CharByte xor Ord(Key[Ctr]);
  if not (CharByte in [0, 32]) then
      FBuffer[x] := CharByte;
  if Ctr > KeyLen then
      Ctr := 0;
I assume you have this in a loop.  If so, it will slow down the process 
tremendously to call Application.ProcessMessages on every iteration.  Looping 
through a string is a very fast process and you don't need to worry about 
giving time back to Windows during this period.
                                ...Gary
--- GoldED 2.41
---------------
* Origin: The Flying Circus BBS, Farmington Hills, MI, USA. (1:2410/905)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.