自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(1)
  • 资源 (1)
  • 收藏
  • 关注

原创 有谁在广州亿阳信通工作的

有谁在广州亿阳信通工作的,广州亿阳信通的工作地点在哪

2009-03-15 02:37:00 1525

delphi7 cosesoft打印源代码

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; procedure 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.

2010-11-19

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除