454 lines
12 KiB
ObjectPascal
454 lines
12 KiB
ObjectPascal
|
unit U_YarnWeighing;
|
|||
|
|
|||
|
interface
|
|||
|
|
|||
|
uses
|
|||
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
Dialogs, StdCtrls, ExtCtrls, ComCtrls, ToolWin, DB, ADODB, Buttons, cxStyles,
|
|||
|
cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, cxDBData,
|
|||
|
cxGridLevel, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
|
|||
|
cxClasses, cxControls, cxGridCustomView, cxGrid, DBClient, RM_Dataset,
|
|||
|
RM_System, RM_Common, RM_Class, RM_GridReport, IniFiles, cxLookAndFeels,
|
|||
|
cxLookAndFeelPainters, cxNavigator, cxContainer, cxTextEdit, cxMaskEdit,
|
|||
|
cxButtonEdit, dxSkinsCore, dxSkinsDefaultPainters, dxDateRanges, U_BaseList;
|
|||
|
|
|||
|
type
|
|||
|
TfrmYarnWeighing = class(TfrmBaseList)
|
|||
|
CPInfo: TRichEdit;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
Panel3: TPanel;
|
|||
|
Panel4: TPanel;
|
|||
|
Panel2: TPanel;
|
|||
|
SQty: TEdit;
|
|||
|
Label4: TLabel;
|
|||
|
Button3: TButton;
|
|||
|
Panel10: TPanel;
|
|||
|
cxGrid3: TcxGrid;
|
|||
|
Tv3: TcxGridDBTableView;
|
|||
|
cxGridDBColumn1: TcxGridDBColumn;
|
|||
|
v3Column1: TcxGridDBColumn;
|
|||
|
v3Column2: TcxGridDBColumn;
|
|||
|
cxGridLevel2: TcxGridLevel;
|
|||
|
v3Column4: TcxGridDBColumn;
|
|||
|
ADOCmd: TADOQuery;
|
|||
|
CDS_1: TClientDataSet;
|
|||
|
DS_1: TDataSource;
|
|||
|
RM2: TRMGridReport;
|
|||
|
RMDB_Main: TRMDBDataSet;
|
|||
|
ADOQueryPrint: TADOQuery;
|
|||
|
ClientDataSetYS: TClientDataSet;
|
|||
|
Tv3Column3: TcxGridDBColumn;
|
|||
|
Button2: TButton;
|
|||
|
btnSampleSel: TButton;
|
|||
|
Button1: TButton;
|
|||
|
Panel7: TPanel;
|
|||
|
SpeedButton1: TSpeedButton;
|
|||
|
SpeedButton2: TSpeedButton;
|
|||
|
SpeedButton3: TSpeedButton;
|
|||
|
SpeedButton4: TSpeedButton;
|
|||
|
SpeedButton5: TSpeedButton;
|
|||
|
SpeedButton6: TSpeedButton;
|
|||
|
SpeedButton7: TSpeedButton;
|
|||
|
SpeedButton8: TSpeedButton;
|
|||
|
SpeedButton9: TSpeedButton;
|
|||
|
SpeedButton10: TSpeedButton;
|
|||
|
SpeedButton11: TSpeedButton;
|
|||
|
SpeedButton12: TSpeedButton;
|
|||
|
procedure FormDestroy(Sender: TObject);
|
|||
|
procedure btnSampleSelClick(Sender: TObject);
|
|||
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure Button1Click(Sender: TObject);
|
|||
|
procedure SpeedButton1Click(Sender: TObject);
|
|||
|
procedure SpeedButton12Click(Sender: TObject);
|
|||
|
procedure Button3Click(Sender: TObject);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure Button2Click(Sender: TObject);
|
|||
|
private
|
|||
|
FMainid, FY_Code, FY_Name, FY_Spec, FY_Composition, FY_Color, FNote: string;
|
|||
|
FFFMJID: string;
|
|||
|
IsCommopen: boolean;
|
|||
|
procedure InitJP(FName: string); //ˢ<><CBA2><EFBFBD><EFBFBD><EFBFBD>ּ<EFBFBD><D6BC><EFBFBD>
|
|||
|
function SaveData(DataType: string): Boolean; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
procedure InitGrid(); //ˢ<>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
function TSInfo(MOKNOFlag, MTSStr: string): Boolean; //<2F><>ʾ<EFBFBD><CABE><EFBFBD>Ӵ<EFBFBD><D3B4><EFBFBD>
|
|||
|
procedure PrtData(MYIID: string); //<2F><>ӡ<EFBFBD><D3A1>ǩ
|
|||
|
procedure OpenCom(DllName: string);
|
|||
|
procedure CloseCom(DllName: string);
|
|||
|
procedure On1201(var Message: Tmessage); message 1201; //<2F><><EFBFBD>ӳ<EFBFBD>
|
|||
|
public
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmYarnWeighing: TfrmYarnWeighing;
|
|||
|
newh, newh1: hwnd;
|
|||
|
IniFile: TIniFile;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_iniParam, U_RTFun, U_TSOKNO, U_ZDYHelp, U_CPSelBig;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmYarnWeighing.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
frmYarnWeighing := nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnWeighing.On1201(var Message: Tmessage);
|
|||
|
var
|
|||
|
i1, i2: integer;
|
|||
|
FMJMaoZ: Double;
|
|||
|
begin
|
|||
|
i1 := Message.WParam;
|
|||
|
i2 := Message.LParam;
|
|||
|
FMJMaoZ := RoundFloat(i1 * i2 / 100000, 2);
|
|||
|
SQty.Text := floattostr(FMJMaoZ);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnWeighing.btnSampleSelClick(Sender: TObject); //ѡ<><D1A1>Ʒ<EFBFBD><C6B7>
|
|||
|
begin
|
|||
|
try
|
|||
|
frmCPSelBig := TfrmCPSelBig.Create(Self);
|
|||
|
with frmCPSelBig do
|
|||
|
begin
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
CPInfo.Hint := FHMainId;
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmCPSelBig.Close;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from BS_Yarn_Info where BYIID=''' + Trim(CPInfo.Hint) + '''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
FMainid := Trim(fieldbyname('BYIID').AsString);
|
|||
|
FY_Code := Trim(fieldbyname('Y_Code').AsString);
|
|||
|
FY_Name := Trim(fieldbyname('Y_Name').AsString);
|
|||
|
FY_Spec := Trim(fieldbyname('Y_Spec').AsString);
|
|||
|
FY_Composition := Trim(fieldbyname('Y_Composition').AsString);
|
|||
|
FY_Color := Trim(fieldbyname('Y_Color').AsString);
|
|||
|
FNote := Trim(fieldbyname('Note').AsString);
|
|||
|
end;
|
|||
|
ADOQueryTemp.Close;
|
|||
|
|
|||
|
CPInfo.Text := ' ' + #13 + '<27><><EFBFBD>ţ<EFBFBD>' + Trim(FY_Code) + #13 + #13;
|
|||
|
CPInfo.Text := CPInfo.Text + 'Ʒ<><C6B7><EFBFBD><EFBFBD>' + Trim(FY_Name) + #13 + #13;
|
|||
|
CPInfo.Text := CPInfo.Text + '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' + Trim(FY_Spec) + #13 + #13;
|
|||
|
CPInfo.Text := CPInfo.Text + '<27>ɷ֣<C9B7>' + Trim(FY_Composition) + #13 + #13;
|
|||
|
CPInfo.Text := CPInfo.Text + '<27><>ɫ<EFBFBD><C9AB>' + Trim(FY_Color) + #13 + #13;
|
|||
|
CPInfo.Text := CPInfo.Text + '<27><>ע<EFBFBD><D7A2>' + Trim(FNote) + #13 + #13;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnWeighing.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnWeighing.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
CloseCom(DZCDYDllName);
|
|||
|
Action := caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnWeighing.Button1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
WriteCxGrid(Self.Caption + '1', Tv3, 'ɴ<>߳<EFBFBD><DFB3><EFBFBD>');
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnWeighing.Button2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_1.IsEmpty then
|
|||
|
Exit;
|
|||
|
if TSInfo('ѡ<><D1A1>', 'ȷ<><C8B7>Ҫ<EFBFBD>ش<EFBFBD><D8B4><EFBFBD>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>') then
|
|||
|
begin
|
|||
|
PrtData(Trim(CDS_1.fieldbyname('YIID').AsString));
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnWeighing.InitJP(FName: string);
|
|||
|
var
|
|||
|
i: Integer;
|
|||
|
begin
|
|||
|
with Panel7 do
|
|||
|
begin
|
|||
|
for i := 0 to ControlCount - 1 do
|
|||
|
begin
|
|||
|
if Controls[i] is TSpeedButton then
|
|||
|
begin
|
|||
|
TSpeedButton(Controls[i]).Hint := Trim(FName);
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
TEdit(FindComponent(FName)).SetFocus;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnWeighing.SpeedButton1Click(Sender: TObject);
|
|||
|
var
|
|||
|
fsj: string;
|
|||
|
begin
|
|||
|
fsj := Trim(TSpeedButton(Sender).Hint);
|
|||
|
if Trim(fsj) = '' then
|
|||
|
Exit;
|
|||
|
fsj := Trim(TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).Text);
|
|||
|
TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).Text := fsj + Trim(TSpeedButton(Sender).Caption);
|
|||
|
TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).SelectAll;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnWeighing.SpeedButton12Click(Sender: TObject);
|
|||
|
var
|
|||
|
fsj: string;
|
|||
|
begin
|
|||
|
fsj := Trim(TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).Text);
|
|||
|
if Trim(fsj) = '' then
|
|||
|
Exit;
|
|||
|
TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).Text := Copy(fsj, 1, Length(fsj) - 1);
|
|||
|
TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).SelectAll;
|
|||
|
end;
|
|||
|
|
|||
|
function TfrmYarnWeighing.SaveData(DataType: string): Boolean;
|
|||
|
var
|
|||
|
Maxno, MBYIOID: string;
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOCmd.Connection.BeginTrans;
|
|||
|
CDS_1.DisableControls;
|
|||
|
|
|||
|
if not GetLSNo(ADOCmd, Maxno, 'PR', 'BS_Yarn_IO', 3, 1) then
|
|||
|
raise Exception.Create('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
|
|||
|
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from BS_Yarn_IO where BYIOID=''' + Trim(Maxno) + '''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
|
|||
|
Append;
|
|||
|
FieldByName('Fillid').Value := Trim(Dcode);
|
|||
|
FieldByName('Filler').Value := Trim(DName);
|
|||
|
FieldByName('IOTime').Value := SGetServerDate(ADOQueryTemp);
|
|||
|
FieldByName('Y_Code').Value := FY_Code;
|
|||
|
FieldByName('Y_Name').Value := FY_Name;
|
|||
|
FieldByName('Y_Spec').Value := FY_Spec;
|
|||
|
FieldByName('Y_Composition').Value := FY_Composition;
|
|||
|
FieldByName('Y_Color').Value := FY_Color;
|
|||
|
FieldByName('STKName').Value := '<27>Ϲ<EFBFBD>˿';
|
|||
|
FieldByName('BYIOID').Value := Trim(Maxno);
|
|||
|
FieldByName('STKID').Value := Trim(Maxno);
|
|||
|
FFFMJID := Maxno;
|
|||
|
FieldByName('IOFlag').Value := '<27><><EFBFBD><EFBFBD>';
|
|||
|
FieldByName('IOQtyFlag').Value := 1;
|
|||
|
FieldByName('IOType').Value := '<27>Ϲ<EFBFBD><CFB9><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
FieldByName('Qty').Value := trim(SQty.Text);
|
|||
|
FieldByName('QtyUnit').Value := 'Kg';
|
|||
|
Post;
|
|||
|
end;
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update BS_Yarn_IO Set StkPiece=(select Sum(isnull(Piece,0)*IOQtyFlag) from BS_Yarn_IO A where A.STKID=BS_Yarn_IO.BYIOID)');
|
|||
|
sql.Add(',STKQty=(select Sum(isnull(Qty,0)*IOQtyFlag) from BS_Yarn_IO A where A.STKID=BS_Yarn_IO.BYIOID )');
|
|||
|
sql.Add('where BYIOID=''' + Trim(Maxno) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
CDS_1.EnableControls;
|
|||
|
ADOCmd.Connection.CommitTrans;
|
|||
|
|
|||
|
Result := True;
|
|||
|
except
|
|||
|
Result := False;
|
|||
|
ADOCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnWeighing.PrtData(MYIID: string);
|
|||
|
var
|
|||
|
fPrintFile: string;
|
|||
|
begin
|
|||
|
ExportFtErpFile('<27>Ϲ<EFBFBD>ɴ<EFBFBD>߱<EFBFBD>ǩ.rmf', ADOQueryTemp);
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C>Ϲ<EFBFBD>ɴ<EFBFBD>߱<EFBFBD>ǩ.rmf';
|
|||
|
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add(' exec P_Yarn_Prt_Lab ''' + Trim(MYIID) + '''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryPrint.IsEmpty then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>δ<EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
RM2.LoadFromFile(fPrintFile);
|
|||
|
Rm2.DefaultCopies := 1;
|
|||
|
RM2.PrintReport;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnWeighing.Button3Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if TSInfo('ѡ<><D1A1>', 'ȷ<><C8B7>Ҫ<EFBFBD><D2AA>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݴ<EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD><EFBFBD>ݽ<EFBFBD><DDBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<DEB8>') then
|
|||
|
begin
|
|||
|
if SaveData('<27><><EFBFBD><EFBFBD>') then
|
|||
|
begin
|
|||
|
PrtData(Trim(FFFMJID));
|
|||
|
SQty.Text := '';
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
function TfrmYarnWeighing.TSInfo(MOKNOFlag, MTSStr: string): Boolean;
|
|||
|
begin
|
|||
|
try
|
|||
|
frmTSOKNO := TfrmTSOKNO.Create(Application);
|
|||
|
with frmTSOKNO do
|
|||
|
begin
|
|||
|
frmTSOKNO.TSStr := MTSStr;
|
|||
|
frmTSOKNO.OKNOFlag := MOKNOFlag;
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
Result := retbol;
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmTSOKNO.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnWeighing.InitGrid();
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from BS_Yarn_IO where Convert(varchar(10),FillTime,120)=Convert(varchar(10),Getdate(),120)');
|
|||
|
sql.Add(' and Filler=''' + Trim(DName) + ''' order by FillTime desc ');
|
|||
|
// showmessage(SQL.Text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS(ADOQueryTemp, CDS_1);
|
|||
|
SInitCDSData(ADOQueryTemp, CDS_1);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnWeighing.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
ReadCxGrid(Self.Caption, Tv3, 'ɴ<>߳<EFBFBD><DFB3><EFBFBD>');
|
|||
|
try
|
|||
|
IniFile := TIniFile.Create(ExtractFilePath(Application.ExeName) + 'FileKPZ.INI');
|
|||
|
DZCDYDllName := IniFile.ReadString('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><><EFBFBD>ӳӵ<D3B3><D3B5><EFBFBD>Dll<6C>ļ<EFBFBD>', '');
|
|||
|
finally
|
|||
|
IniFile.Free;
|
|||
|
end;
|
|||
|
InitGrid();
|
|||
|
if DZCDYDllName <> '' then
|
|||
|
begin
|
|||
|
OpenCom(DZCDYDllName);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnWeighing.OpenCom(DllName: string);
|
|||
|
type
|
|||
|
TMyFunc = function(fhandle: hwnd; sCommName: PAnsiChar; IntTime: integer; IsMessage: integer): HWND; stdcall;
|
|||
|
var
|
|||
|
Tf: TMyFunc;
|
|||
|
Tp: TFarProc;
|
|||
|
Th: Thandle;
|
|||
|
begin
|
|||
|
// closeCom(FComFile);
|
|||
|
Th := LoadLibrary(Pchar(trim(DllName)));
|
|||
|
if Th > 0 then
|
|||
|
begin
|
|||
|
try
|
|||
|
Tp := GetProcAddress(Th, 'CommOpen');
|
|||
|
if Tp <> nil then
|
|||
|
begin
|
|||
|
Tf := TMyFunc(Tp);
|
|||
|
newh := Tf(self.Handle, 'Comm1', 500, 1);
|
|||
|
if newh < 1 then
|
|||
|
begin
|
|||
|
application.MessageBox(Pchar('<27><EFBFBD><F2BFAAB4><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>'), '<27><>ʾ');
|
|||
|
end
|
|||
|
else
|
|||
|
IsCommOpen := true;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
IsCommOpen := false;
|
|||
|
end;
|
|||
|
finally
|
|||
|
// FreeLibrary(Th);
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
IsCommOpen := false;
|
|||
|
application.MessageBox(Pchar('<27>Ҳ<EFBFBD><D2B2><EFBFBD> ' + trim(DllName) + ' <20>ļ<EFBFBD><C4BC><EFBFBD>'), '<27><>ʾ');
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnWeighing.CloseCom(DllName: string);
|
|||
|
type
|
|||
|
TMyFunc = function(sCommName: PAnsiChar): HWND; stdcall;
|
|||
|
var
|
|||
|
Tf1: TMyFunc;
|
|||
|
Tp1: TFarProc;
|
|||
|
Th1: Thandle;
|
|||
|
begin
|
|||
|
Th1 := LoadLibrary(Pchar(trim(DllName)));
|
|||
|
if Th1 > 0 then
|
|||
|
begin
|
|||
|
try
|
|||
|
Tp1 := GetProcAddress(Th1, 'CommClose');
|
|||
|
if Tp1 <> nil then
|
|||
|
begin
|
|||
|
Tf1 := TMyFunc(Tp1);
|
|||
|
newh1 := Tf1('Comm1');
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
finally
|
|||
|
// FreeLibrary(Th1);
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
application.MessageBox(Pchar('<27>Ҳ<EFBFBD><D2B2><EFBFBD> ' + trim(DllName) + ' <20>ļ<EFBFBD><C4BC><EFBFBD>'), '<27><>ʾ');
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|