Delphi stream read error when loading image -


my program loads lot of images, have problem 1 image used print-screen button copy it, game, bmp, rest. whenever run program, says project1.exe raised exception class ereaderror message 'stream read error' process stopped....

the code this:

procedure tform1.formcreate(sender: tobject); var path, destination:string; begin path:=paramstr(0); destination:=extractfilepath(path)+'leagueoflegendsdesktop.bmp'; image1.picture.loadfromfile(destination); end; 

which correct. suggest me?

the explanation file not valid windows bitmap (maybe file truncated). or perhaps file uses esoteric format not supported delphi. using run-length encoding, example.

if file did not exist you'd different error, 1 indicated no such file exists. so, file exists cannot loaded. ergo, it's not windows bitmap.

step 1 diagnose @ format of file. load bitmap file header , check values make sense. easiest way step through vcl code when running program under debugger. enable debug dcus option can that. set breakpoint in tbitmap.readstream in graphics unit , take there.

having said that, may easier avoid trying debug problem @ all. if can load image image editor, save new copy of image in format read delphi. example plain vanilla windows bitmap, or, better, png file admit compression.


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -