Page 1 of 1

Using progress callback

Posted: Fri Mar 25, 2011 9:46 am
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.

Re: Using progress callback

Posted: Fri Apr 01, 2011 10:49 pm
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 );

Re: Using progress callback

Posted: Fri Jul 01, 2011 12:58 pm
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.