library DPdbgirdset;
uses
ShareMem,
Windows,
ADODB,
DBClient,
Forms,
// Ucalssbox,
comobj,
activex,
SysUtils,
Classes,
Ucalssbox in 'Ucalssbox.pas',
UndbgridSet in 'UndbgridSet.pas',
UnitWriteLog in 'Unitwritelog.pas';
{$R *.res}
var
DllApp: Tapplication;
procedure ExitDll(Reason:integer);
begin
if Reason=DLL_PROCESS_DETACH then
begin
oleuninitialize;
CoUnInitialize;
application:=DllApp;
end;
end;
////////////////////主控台application//主控台screen////
function CreateFormDll(app: Tapplication; MainHandleTemp:THandle; operatorNo, operatorName
char;
var ClientroleTemp: TClientDataSet; ADOSubTemp: TADOConnection):TForm; stdcall;
///工号////工号姓名///////////// 控台传来权限表/////////////////主控台传来连接//////////////
var
roleTemp: Pclintrole;
begin
application:= app;
MainHandle:= MainHandleTemp;
roleTemp:= @ClientroleTemp;
result:= TicketDeal(roleTemp,ADOSubTemp,operatorNo,operatorName);
end;
exports
CreateFormDll;
begin
OleInitialize(nil);
CoInitialize(nil);
Dllapp:=application;
Dllproc:=@exitdll;
end.
function TicketDeal(Clientrole: Pclintrole; ADOConnTemp: TADOConnection; ManagerNOTemp,ManagerNameTemp: Pchar):TForm;
var
appath: string;
operTemp: PoperList;
i:integer;
Listtemp: PoperList;
begin
ProleTable:= Clientrole;
AdoConn:= ADOConnTemp;
ManagerNO:= string(ManagerNOTemp);
application.CreateForm(TFndbgridSet,FndbgridSet);
FndbgridSet.DBGrid1.Columns.Add;
FndbgridSet.DBGrid1.Columns[0].FieldName:='chinese_name';
FndbgridSet.DBGrid1.Columns[0].Width:=100;
FndbgridSet.DBGrid1.Columns[0].Title.caption:='操作项目';
FndbgridSet.DBGrid1.Columns[0].Title.Alignment:= taCenter;
try
Clientoper:= TClientDataSet.Create(nil);
Clientoper.Data:= ProleTable^.Data;
except
on E:exception do
begin
Clientoper:=nil;
Clientoper.Free;
writelog(e.Message);
result:=nil;
exit;
end;
end;
FilterRoleTemp('item_type='+QuotedStr('dbgridset'),Clientoper);
FndbgridSet.DataSource1.DataSet:= Clientoper;
Expression:= Tlist.Create;
i:=0;
while not Clientoper.Eof do
begin
new(operTemp);
operTemp.chinaName:= Clientoper.fieldbyname('chinese_name').AsString;
operTemp.ChinaBds:='';
operTemp.EngleshBds:='';
operTemp.Plist:= nil;
Expression.Add(operTemp);
if i>0 then
begin
operTemp^.Plist:= Expression.Items[i-1];
end;
inc(i);
Clientoper.Next;
end;
Listboxclass:=TListboxclass.Create(ProleTable,'goods_kind','1');
Listboxclass.jszdBox:= @FndbgridSet.ListBox4;
Listboxclass.dataOperBox:= @FndbgridSet.ListBox1;
Listboxclass.operBox:= @FndbgridSet.ListBox3;
Listboxclass.funcBox:= @FndbgridSet.ListBox2;
Listboxclass.dataOperStr:= Clientoper.fieldbyname('english_name').AsString;
appath:= ExtractFilePath(application.ExeName)+'hcpos.ini';
Listboxclass.operPath:=appath;
Listboxclass.funcPath:=appath;
if FndbgridSet.dbgrid2.Columns.Count<>0 then FndbgridSet.dbgrid2.Columns.Clear;
with FndbgridSet.dbgrid2 do
begin
Columns.Add;
Columns[0].FieldName:='chinese_name';
Columns[0].Title.caption:= '操作项目';
Columns[0].Width:= 60;
Columns[0].Title.Alignment:= taCenter;
Columns.Add;
Columns[1].FieldName:='total';
Columns[1].Title.caption:= '合计选项';
Columns[1].Width:= 60;
Columns[1].Title.Alignment:= taCenter;
Columns[1].PickList.add('fvtnon');
Columns[1].PickList.add('fvtcount');
Columns[1].PickList.add('fvtstatictext');
Columns[1].PickList.add('fvtsum');
Columns[1].PickList.add('fvtAvg');
end;
if FndbgridSet.DataSource2.DataSet=nil then FndbgridSet.DataSource2.DataSet:= ProleTable^;
FndbgridSet.dbgrid2.DataSource:= FndbgridSet.DataSource2;
i:=0;
for i:= Expression.Count-1 downto 0 do
begin
Listtemp:= Expression.Items
;
if Listtemp^.chinaName= Clientoper.fieldbyname('chinese_name').AsString then
begin
// excindex:=I;
FndbgridSet.memo1.Text:= Listtemp^.ChinaBds+Listtemp^.EngleshBds;
break;
end;
end;
dj:=0;
excindex:=0;
result:= FndbgridSet;
在主程序中操作ProleTable 进出地址错误