您好,欢迎光临本网站![请登录][注册会员]  
文件名称: delphi7 cosesoft打印源代码
  所属分类: QT
  开发工具:
  文件大小: 7kb
  下载次数: 0
  上传时间: 2010-11-19
  提 供 者: bios****
 详细说明: unit CodeSoft; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, DdeMan, ComObj, stdctrls, IniFiles; type TDMCodeSoft = class(TDataModule) CSDdeClientConv: TDdeClientConv; procedure DataModuleCreate(Sender: TObject); procedure DataModuleDestroy(Sender: TObject); private M_sOldFileName : String; M_slCSParam : TStringList; function csFileName(psFileName: String): String; procedure csSet(psFieldName,psFieldValue: String); procedure listVar; proce dure closeLink; procedure startLink; public procedure CSFullScreen; procedure CSLockScreen; function printToCodeSoft(psLabelFile:string; piLabelQty:integer; plsListBoxItem,plsListBoxData:TObject):Boolean; end; var DMCodeSoft: TDMCodeSoft; implementation {$R *.DFM} function TDMCodeSoft.printToCodeSoft(psLabelFile:string; piLabelQty:integer; plsListBoxItem, plsListBoxData:TObject):Boolean; var i : integer; begin if not FileExists(psLabelFile) then begin showmessage('error!-The Label file ' + psLabelFile+' can''t be found.'); Result := False; exit; end; Result := True; try if M_sOldFileName <> psLabelFile then begin if M_sOldFileName <> '' then begin while True do begin if not CSDdeClientConv.WaitStat then begin CSDdeClientConv.ExecuteMacro(PChar('[CloseLab('+csFileName(M_sOldFileName)+')]'),False); Break; end; end; end; while True do begin if not CSDdeClientConv.WaitStat then begin CSDdeClientConv.ExecuteMacro(PChar('[OpenLab('+csFileName(psLabelFile)+')]'),False); M_sOldFileName := psLabelFile; Break; end; end; end; listVar; for i := 1 to M_slCSParam.Count do begin if (plsListBoxItem as TListBox).Items.IndexOf(M_slCSParam[i-1]) <> -1 then begin csSet((plsListBoxItem as TListBox).Items[i-1],'"'+ (plsListBoxData as TListBox).Items[(plsListBoxItem as TListBox).Items.IndexOf(M_slCSParam[i-1])]+'"'); end; end; while True do begin if not CSDdeClientConv.WaitStat then begin CSDdeClientConv.ExecuteMacro(PChar('[PrintLabel('+IntToStr(piLabelQty)+')]'),False); Break; end; end; while True do begin if not CSDdeClientConv.WaitStat then begin CSDdeClientConv.ExecuteMacro(PChar('[FormFeed()]'),False); Break; end; end; except end; end; procedure TDMCodeSoft.CSFullScreen; begin while True do begin if not CSDdeClientConv.WaitStat then begin CSDdeClientConv.ExecuteMacro(PChar('[Display(F)]'),False); Break; end; Sleep(500); end; end; procedure TDMCodeSoft.CSLockScreen; begin while True do begin if not CSDdeClientConv.WaitStat then begin CSDdeClientConv.ExecuteMacro(PChar('[Display(K)]'),False); Break; end; Sleep(500); end; end; procedure TDMCodeSoft.closeLink; begin CSDdeClientConv.PokeData('Close','1'); CSDdeClientConv.CloseLink; end; function TDMCodeSoft.csFileName(psFileName: String): String; var sFileNameTemp: String; iCount: Integer; begin for iCount := 1 to Length(psFileName) do begin case psFileName[iCount] of '\': sFileNameTemp := sFileNameTemp + '\\'; '[': sFileNameTemp := sFileNameTemp + '\['; ']': sFileNameTemp := sFileNameTemp + '\]'; '"': sFileNameTemp := sFileNameTemp + '\"'; ',': sFileNameTemp := sFileNameTemp + '\,'; '(': sFileNameTemp := sFileNameTemp + '\('; ')': sFileNameTemp := sFileNameTemp + '\)'; else sFileNameTemp := sFileNameTemp + psFileName[iCount]; end; end; Result := sFileNameTemp; end; procedure TDMCodeSoft.csSet(psFieldName,psFieldValue: String); begin while True do if not CSDdeClientConv.WaitStat then begin CSDdeClientConv.ExecuteMacro(PChar('[Set('+psFieldName+','+psFieldValue+')]'),False); Break; end; end; procedure TDMCodeSoft.listVar; var sTextTemp, sText: String; iCount: Integer; begin sTextTemp := ''; sText := ''; M_slCSParam.Clear; while True do begin if not CSDdeClientConv.WaitStat then begin sTextTemp := StrPas(CSDdeClientConv.RequestData('VARLIST')); Break; end; end; for iCount := 1 to Length(sTextTemp) do begin if sTextTemp[iCount] = ';' then begin M_slCSParam.Add(sText); sText := ''; end else sText := sText + sTextTemp[iCount]; end; if sText <> '' then M_slCSParam.Add(sText); end; procedure TDMCodeSoft.startLink; var WinINI, CSINI: TIniFile; CSPath, CSEXE: String; begin WinINI := TIniFile.Create('Win.INI'); try CSPath := WinINI.ReadString('CS','Path',''); if CSPath = '' then CSPath := WinINI.ReadString('CS4DMX','Path',''); if CSPath = '' then CSPath := WinINI.ReadString('ELTPLUS','Path',''); if CSPath = '' then CSPath := WinINI.ReadString('LSPRO','Path',''); if CSPath = '' then CSPath := WinINI.ReadString('CSRUN','Path',''); if CSPath = '' then CSPath := WinINI.ReadString('DMXRUN','Path',''); if CSPath = '' then CSPath := WinINI.ReadString('ELTRUN','Path',''); if CSPath = '' then CSPath := WinINI.ReadString('LSRUN','Path',''); if CSPath = '' then CSPath := WinINI.ReadString('LWISE','Path',''); if CSPath = '' then CSPath := WinINI.ReadString('LWRUN','Path',''); if CSPath = '' then CSPath := WinINI.ReadString('IPAL','Path',''); if CSPath = '' then CSPath := WinINI.ReadString('IPALRUN','Path',''); if CSPath = '' then CSPath := WinINI.ReadString('IMPULS','Path',''); if CSPath = '' then CSPath := WinINI.ReadString('IMPRUN','Path',''); if CSPath = '' then CSPath := WinINI.ReadString('VITA','Path',''); if CSPath = '' then CSPath := WinINI.ReadString('VITARUN','Path',''); finally WinINI.Free; end; if CSPath = '' then begin MessageDLG('Please install Code soft!!',mtError,[mbOK],0); Application.Terminate; end; CSINI := TIniFile.Create(CSPath+'\CS.INI'); try CSEXE := CSINI.ReadString('General','ExeName',''); finally CSINI.Free; end; CSDdeClientConv.ServiceApplication := CSPath+'\'+CSEXE; CSDdeClientConv.SetLink('CS','CS'); while True do begin if CSDdeClientConv.OpenLink then Break; CSDdeClientConv.ServiceApplication := ''; sleep(500); end; end; procedure TDMCodeSoft.DataModuleCreate(Sender: TObject); begin startLink; CSLockScreen; M_slCSParam := TStringList.Create; end; procedure TDMCodeSoft.DataModuleDestroy(Sender: TObject); begin M_slCSParam.Free; closeLink; end; end. ...展开收缩
(系统自动生成,下载前可以参看下载内容)

下载文件列表

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.
 相关搜索: cosesoft打印源代码
 输入关键字,在本站1000多万海量源码库中尽情搜索: