Home > Back-end >  Questions about the Dll progress bar
Questions about the Dll progress bar

Time:09-25

Program in reading a large file, because the time is long, to make a progress bar to display the read progress, read the program written in a Dll, please issue how to pass the current progress value in real time to the main program, the main program according to the value according to schedule,
Thank you for your attention, only so many points,

CodePudding user response:

The main program in the handle incoming call DLL functions in time, and then use a custom message to inform the main program, of course, can also be the other way around, the main program (such as a Timer) to access the DLL, obtain progress, then update the interface,

CodePudding user response:

DLL get a callback

CodePudding user response:

Do a callback in the DLL, back to read into position

CodePudding user response:

I'm sorry, don't know much about the callback, I do not know can you give some code,
Such as Dll in do a cycle
Procedure test (x, y: uint64);
The begin
While xThe begin
Inc (x);
end;
end;


How the progress bar is shown in the main program,
Thank you for the

CodePudding user response:

Procedure test (x, y: uint64; Prb1: TProgressBar); Stdcall;
The begin
Prb1. Max:=y;
While xThe begin
Inc (x);
Prb1. Position:=prb1. Position + 1;
end;
Prb1. Position:=0;
end;

In the main program puts a TProgressBar, call this function when the inside is ok,

CodePudding user response:

To: wuhs

This Dll to call in c #, written in c # can call like this?

CodePudding user response:

Estimates only Delphi call

CodePudding user response:

Why don't want to call in c #, c # write a Dll in

CodePudding user response:

Because I will only be Delphi, customers want to use c #

CodePudding user response:

PostMessage to the main program

CodePudding user response:

Type
TNotifyProgress=procedure (Current; Total); Stdcall;
Var
FNotifyProgress: TNotifyProgress;

Procedure test (x, y: uint64; Prb1: TProgressBar); Stdcall;
The begin
Prb1. Max:=y;
While xThe begin
Inc (x);
Prb1. Position:=prb1. Position + 1;

FNotifyProgress (prb1 Position, Total);
end;
Prb1. Position:=0;
end;

Procedure SetNotifyProgress (proc: TNotifyProgress); Stdcall;//this function
The begin
FNotifyProgress:=proc;
end;



CodePudding user response:

As above, the use of the callback function, simple, safe, intuitive,
TGovBase=Class (TInterfacedObject IGovBase)
Private
Protected
The adc: TADOConnection;
RST, rstTmp: TADOQuery;
FCBF: TCBF;
AppPath: string;
The function GetConnection: TADOConnection;
Procedure SetConnection (Value: TADOConnection);
The function getCBF: TCBF;
Procedure setCBF (Value: TCBF); Virtual;
Procedure FreeAndNilRst (r: TADOQuery);
Public
The constructor Create (_Connection: TADOConnection); Virtual;
The destructor Destroy; Virtual;
//specify the data link, in front of the other procedure calls, please specify the link
The property Connection: TADOConnection read GetConnection write SetConnection;
//specified schedule shows the callback function
The property PrsBackCall: TCBF read getCBF write setCBF;
////public function
The function FmtDate (FDate: String) : String;//the date format will 199901 into the 1999-01-01
The function FmtDatePrint (FDate: String) : String;//formatting date, will be converted into 1999.01, 199901199-01-01 is mainly used in the output table
The function GetAge (sDate: String) : String;
end;

It is through the interface call DLL object definition, also use a callback function pass data back to the main program,

CodePudding user response:

Set the print different pages, respectively using a different printer,
  • Related