Using progress callback

Discussions on GFL SDK, the graphic library for reading and writing graphic files

Moderators: XnTriq, helmut, xnview

Post Reply
Peter_K
Posts: 2
Joined: Fri Mar 25, 2011 9:20 am

Using progress callback

Post by Peter_K »

Hello.

I'm trying to use progress callback procedure while loading a picture.
Here is the code (modified example from GflSDK\Delphi\Demo\Source\):

Code: Select all

procedure ProgressCallback(percent: GFL_INT32; user_params: Pointer); stdcall;
begin
  Application.MessageBox('Procedure is called', 'OK', MB_OK + MB_ICONINFORMATION);
end;

procedure LoadPicture(FileName: string);
...
begin
...
  lp.Callbacks.Progress := ProgressCallback;
  e := gflLoadBitmap(PChar(FileName), gfl_bmp, lp, finfo);
...
end;
The picture loads successfully, but procedure ProgressCallback is never called. What am I doing wrong?
Maybe, something must be assigned to TGFL_LOAD_PARAMS.Callbacks.ProgressParams, but I haven't found any description of this parameter or code that uses it.
Thank you in advance.
User avatar
AmigoJack
Posts: 33
Joined: Tue Mar 09, 2010 6:40 pm
Contact:

Re: Using progress callback

Post by AmigoJack »

Works fine for me. I guess you forgot to call this, which is needed to initialize GFL_LOAD_PARAMS:

Code: Select all

gflGetDefaultLoadParams( lp );
Peter_K
Posts: 2
Joined: Fri Mar 25, 2011 9:20 am

Re: Using progress callback

Post by Peter_K »

Code: Select all

gflGetDefaultLoadParams( lp );
No, I had this line, but procedure still wasn't called.

In my project, which is pretty much simple, I've walked around the problem with one of these gifs: http://www.cinemamuseum.ir/images/ajax-loader.gif
But I've never managed to run my callback function.
Post Reply