DLL Code:
library Round;
{ Important note about DLL memory management: ShareMem must be the
first unit in your library's USES clause AND your project's (select
Project-View Source) USES clause if your DLL exports any procedures or
functions that pass strings as parameters or function results. This
applies to all strings passed to and from your DLL--even those that
are nested in records and classes. ShareMem is the interface unit to
the BORLNDMM.DLL shared memory manager, which must be deployed along
with your DLL. To avoid using BORLNDMM.DLL, pass string information
using PChar or ShortString parameters. }
uses
Forms, SysUtils, Classes, Grids, BaseGrid, AdvGrid;
{$R *.RES}
procedure CalRLWater(Sender: TAdvStringGrid; RecordCount: Integer; ResultACol: Integer); stdcall;
begin
if (Sender.Cells[ResultACol,1] = '.') and (Sender.Cells[ResultACol,RecordCount] = '..') then
begin
Sender.Cells[ResultACol,1] := '左水边';
Sender.Cells[ResultACol,RecordCount] := '右水边';
end
else if (Sender.Cells[ResultACol,1] = '..') and (Sender.Cells[ResultACol,RecordCount] = '.') then
begin
Sender.Cells[ResultACol,1] := '右水边';
Sender.Cells[ResultACol,RecordCount] := '左水边';
end
else
begin
Application.MessageBox('error','error',16);
end;
end;
exports
CalRLWater;
begin
end.
这个Round.dll里还有很多类似的程序,都是向TAdvStringGrid写数据的procedure,为了单
个测试,主程序中只调用了CalRLWater。