delphi app freezes whole win7 system

Posted by avar on Stack Overflow See other posts from Stack Overflow or by avar
Published on 2010-06-16T05:57:33Z Indexed on 2010/06/16 6:02 UTC
Read the original article Hit count: 282

Filed under:
|
|

Hello

i have a simple program that sorts a text file according to length of words per line this program works without problems in my xp based old machine now i run this program on my new win7/intel core i5 machine, it freezes whole system and back normal after it finishes it's work.

i'v invastigated the code and found the line causing the freeze

it was this specific line...

caption := IntToStr(i) + '..' + IntTostr(ii);

i'v changed it to

 caption :=   IntTostr(ii);  //slow rate change

and there is no freeze

and then i'v changed it to

caption :=   IntTostr(i);  //fast rate change

and it freeze again

my main complete procedure code is

 var tword : widestring;
      i,ii,li : integer;
 begin   
     tntlistbox1.items.LoadFromFile('d:\new folder\ch.txt');
     tntlistbox2.items.LoadFromFile('d:\new folder\uy.txt');
     For ii := 15 Downto 1 Do //slow change
      Begin
        For I := 0 To TntListBox1.items.Count - 1 Do //very fast change
        Begin     
          caption := IntToStr(i) + '..' + IntTostr(ii); //problemetic line               
          tword := TntListBox1.items[i];
          LI := Length(tword);
          If lI = ii Then
          Begin             
            tntlistbox3.items.Add(Trim(tntlistbox1.Items[i]));
            tntlistbox4.items.Add(Trim(tntlistbox2.Items[i]));
          End;
        End;
      End;
    end;

any idea why ? and how to fix it? i use delphi 2007/win32

© Stack Overflow or respective owner

Related posts about delphi

Related posts about windows-7