157 lines
3.8 KiB
Plaintext
157 lines
3.8 KiB
Plaintext
unit DWaitProcPrt;
|
|
|
|
interface
|
|
|
|
uses
|
|
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
|
|
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Tocsg.Files;
|
|
|
|
const
|
|
WM_NOTIFY_ADD_IMGFILE = WM_USER + 8474;
|
|
|
|
type
|
|
ThdFileCounting = class(TTgDirWatchBase)
|
|
protected
|
|
hRcvWnd_: HWND;
|
|
sFName_: String;
|
|
procedure ProcessDirWatchEnt(Sender: TObject; pInfo: PDirWatchEnt); override;
|
|
public
|
|
Constructor Create(hRcvWnd: HWND; sFName: String);
|
|
end;
|
|
|
|
TDlgWaitExtrProcPrt = class(TForm)
|
|
lbMsg: TLabel;
|
|
lbProg: TLabel;
|
|
private
|
|
{ Private declarations }
|
|
dwCurPages_,
|
|
dwTotalPages_: DWORD;
|
|
ThdFCount_: ThdFileCounting;
|
|
public
|
|
{ Public declarations }
|
|
Constructor Create(aOwner: TComponent; dwTotalPages: DWORD; sWorkDir, sFName: String); overload;
|
|
Constructor Create(aOwner: TComponent; dwTotalPages: DWORD); overload;
|
|
procedure CreateParams(var Params: TCreateParams); override; // 작업표시줄에 표시
|
|
Destructor Destroy; override;
|
|
|
|
procedure SetPagePos(nPagePos: Integer);
|
|
|
|
procedure process_WM_NOTIFY_ADD_IMGFILE(var msg: TMessage); Message WM_NOTIFY_ADD_IMGFILE;
|
|
procedure process_WM_SYSCOMMAND(var msg: TWMSysCommand); Message WM_SYSCOMMAND;
|
|
end;
|
|
|
|
var
|
|
DlgWaitExtrProcPrt: TDlgWaitExtrProcPrt;
|
|
|
|
implementation
|
|
|
|
uses
|
|
Tocsg.Exception;
|
|
|
|
resourcestring
|
|
RS_SecuPrint = '보안 출력 중...';
|
|
RS_MsgSecuPrinting = '보안이 적용된 문서를 출력중입니다.' + #13#10 + '잠시만 기다려 주십시오.';
|
|
|
|
{$R *.dfm}
|
|
|
|
{ ThdFileCounting }
|
|
|
|
Constructor ThdFileCounting.Create(hRcvWnd: HWND; sFName: String);
|
|
begin
|
|
Inherited Create(false, false);
|
|
hRcvWnd_ := hRcvWnd;
|
|
sFName_ := sFName;
|
|
end;
|
|
|
|
procedure ThdFileCounting.ProcessDirWatchEnt(Sender: TObject; pInfo: PDirWatchEnt);
|
|
begin
|
|
try
|
|
case pInfo.dwAction of
|
|
1 :
|
|
begin
|
|
if Pos(sFName_, pInfo.sPath) > 0 then
|
|
PostMessage(hRcvWnd_, WM_NOTIFY_ADD_IMGFILE, 0, 0);
|
|
end;
|
|
end;
|
|
except
|
|
on E: Exception do
|
|
ETgException.TraceException(Self, E, 'Fail .. ThdFileCounting()');
|
|
end;
|
|
end;
|
|
|
|
{ TDlgWaitExtrPrtData}
|
|
|
|
Constructor TDlgWaitExtrProcPrt.Create(aOwner: TComponent; dwTotalPages: DWORD; sWorkDir, sFName: String);
|
|
begin
|
|
Inherited Create(aOwner);
|
|
dwCurPages_ := 0;
|
|
dwTotalPages_ := dwTotalPages;
|
|
|
|
// if dwTotalPages_ > 0 then
|
|
// lbProg.Caption := Format('(0 / %d)', [dwTotalPages_])
|
|
// else
|
|
lbProg.Caption := '...';
|
|
|
|
|
|
ThdFCount_ := ThdFileCounting.Create(Handle, sFName);
|
|
ThdFCount_.AddDirWatch(sWorkDir);
|
|
ThdFCount_.StartWatch;
|
|
end;
|
|
|
|
Constructor TDlgWaitExtrProcPrt.Create(aOwner: TComponent; dwTotalPages: DWORD);
|
|
begin
|
|
Inherited Create(aOwner);
|
|
|
|
ThdFCount_ := nil;
|
|
|
|
dwCurPages_ := 0;
|
|
dwTotalPages_ := dwTotalPages;
|
|
lbProg.Caption := '...';
|
|
|
|
Caption := RS_SecuPrint;
|
|
lbMsg.Caption := RS_MsgSecuPrinting;
|
|
end;
|
|
|
|
procedure TDlgWaitExtrProcPrt.CreateParams(var Params: TCreateParams);
|
|
begin
|
|
Inherited CreateParams(Params);
|
|
{$IFDEF _HE_}
|
|
Params.ExStyle := WS_EX_APPWINDOW;
|
|
{$ENDIF}
|
|
end;
|
|
|
|
Destructor TDlgWaitExtrProcPrt.Destroy;
|
|
begin
|
|
if ThdFCount_ <> nil then
|
|
FreeAndNil(ThdFCount_);
|
|
Inherited;
|
|
end;
|
|
|
|
procedure TDlgWaitExtrProcPrt.SetPagePos(nPagePos: Integer);
|
|
begin
|
|
// if dwTotalPages_ > 0 then
|
|
// lbProg.Caption := Format('(%d / %d)', [nPagePos, dwTotalPages_])
|
|
// else
|
|
// lbProg.Caption := Format('(%d)', [nPagePos]);
|
|
lbProg.Caption := IntToStr(nPagePos);
|
|
Application.ProcessMessages;
|
|
end;
|
|
|
|
procedure TDlgWaitExtrProcPrt.process_WM_NOTIFY_ADD_IMGFILE(var msg: TMessage);
|
|
begin
|
|
Inc(dwCurPages_);
|
|
lbProg.Caption := IntToStr(dwCurPages_);
|
|
// lbProg.Caption := Format('(%d / %d)', [dwCurPages_, dwTotalPages_]);
|
|
Application.ProcessMessages;
|
|
end;
|
|
|
|
procedure TDlgWaitExtrProcPrt.process_WM_SYSCOMMAND(var msg: TWMSysCommand);
|
|
begin
|
|
if msg.CmdType = SC_CLOSE then
|
|
exit;
|
|
|
|
Inherited;
|
|
end;
|
|
|
|
end.
|