Hello group,
I have question about showing progress while opening a query with many records.
Few weeks ago i got this code from one programmer, for showing progress, but it simply doesn't work for me:
var
ProgressDesc: CBPROGRESSDesc;
function ProgressCallBack(ecbType: CBType; iClientData: Longint;
CbInfo: Pointer): CBRType stdcall;
begin
TForm1(iClientData).Label1.Caption := PChar(@ProgressDesc.szMsg);
TForm1(iClientData).Label1.Update;
Result := cbrUseDef;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
OldSession: hDbiSes;
begin
Session.Open;
DbiGetCurrSession(OldSession);
DbiSetCurrSession(Session.Handle);
DbiRegisterCallBack(nil, cbGENPROGRESS, Integer(self),
SizeOf(ProgressDesc), @ProgressDesc, @ProgressCallBack);
DbiSetCurrSession(OldSession);
Label1.Caption := 'Preparing...';
Label1.Update;
Query1.Open;
Label1.Caption := 'Done.';
end;
Callback function is never called, what is wrong here?
Thanks in advance,
Radovan
PS. Sorry for bad english.