Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

acces violation at address 004b84 in module "SecurityScreensaver.exe"


  • Please log in to reply
2 replies to this topic

#1 Darkyere

Darkyere

    CC Newcomer

  • Just Joined
  • PipPip
  • 13 posts

Posted 01 December 2008 - 05:51 AM

Hello, i have this code who ive been using whitout any problems. and then suddenly at says acces violation at address 004b84 in module

"SecurityScreensaver.exe" when i trie to save a tstringlist to a file.

this is how the code looks
procedure TForm7.Button8Click(Sender: TObject);
var s : tstringlist;
begin
  savedialog1.Title := 'Save image list to file (PS. Remember to add the extension name (etc. *.sss) to the end of the file';

  // Only allow existing files to be selected
  savedialog1.Options := [ofFileMustExist];

  // Allow only *.bmp *.jpeg/jpg *.ico
  savedialog1.Filter := 'All Supportet files|*.Txt; *.SSS|Text files|*.txt|Security Screen Saver File|*.SSS';

  // Select All supportet formats
  savedialog1.FilterIndex := 3;

  // Display the open file dialog
  if savedialog1.Execute then
    begin
      S := TStringList.Create;
      for i := 0 to ListView1.Items.Count do
        begin
          S.Add(ListView1.Items[i].Caption); {This is where the error occurs}
        end;
        S.SaveToFile(savedialog1.FileName);
        S.Free;
        multipleimages := true;
        multipleimagesdes := savedialog1.FileName
    end
  else
    begin
      multipleimages := false;
        multipleimagesdes := 'None';
    end;
end;
Any help would be appreciated,

Best Regards,
Darkyere

Edited by WingedPanther, 01 December 2008 - 08:46 AM.
add code tags (the # button)

  • 0

#2 Darkyere

Darkyere

    CC Newcomer

  • Just Joined
  • PipPip
  • 13 posts

Posted 01 December 2008 - 11:12 AM

i found the answer elsewhere

for i := 0 to Listbox.Items.Count - 1 do

is the corrected problem
  • 0

#3 jakefrog

jakefrog

    CC Lurker

  • Just Joined
  • Pip
  • 9 posts

Posted 03 December 2008 - 06:48 AM

Yea... if you dont put the -1 at the count, it will always recive the wrong count number at the FOR.

this -1 its useable in almost all cases of Items.Count!
  • 0




Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download