// Monitor2Dlg.h : header file
//

#if !defined(AFX_MONITOR2DLG_H__F487C981_391D_475A_9939_939FF61E9B24__INCLUDED_)
#define AFX_MONITOR2DLG_H__F487C981_391D_475A_9939_939FF61E9B24__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000


#import "C:\Projects\Driver\Monitor\TTPMonitor1\TTPMonitor.tlb" no_namespace named_guids


#define PRINTER_STATUS_PAPER_NEAR_END       0x02000000
#define PRINTER_STATUS_PAPER_WEEKEND        0x04000000
#define PRINTER_STATUS_PAPER_PRESENTER      0x08000000
#define PRINTER_STATUS_EXTERNAL_ERROR       0x10000000
#define NAK6								0x00000001
#define NAK7								0x00000002
#define NAK12								0x00000004
#define NAK13								0x00000008
#define NAK14								0x00000010
#define NAK16								0x00000020
#define BUFFEROVERFLOW						0x00000040

typedef struct _CStatusThreadInfo
{
	HWND	myHwnd;
	DWORD	dSleepTime;
	HANDLE	hPrinter;
	HANDLE	hError;
	HANDLE	hStatus;
	BOOL	m_hStatusEventKillThread;
} CStatusThreadInfo;

typedef struct 
{
	HWND	myHwnd;
	CDC		m_DC;
	DWORD	dSleepTime;
	DWORD	dPrintCnt;
	BOOL	m_hKillThread;
	HANDLE	hPrinter;
	HANDLE	hError;
	HANDLE	hStatus;
	int		iPageCount;
	int		iLineCount;
	int		iOrientation;
	LPTSTR	csImage;
	LPTSTR	csPrinter;
} TESTPAR;

/////////////////////////////////////////////////////////////////////////////
// CMonitor2Dlg dialog

class CMonitor2Dlg : public CDialog
{
// Construction
public:
	CMonitor2Dlg(CWnd* pParent = NULL);	// standard constructor
	virtual ~CMonitor2Dlg();			// destructor

	CStatusThreadInfo cTi;
	CWinThread* m_StatusThread;
	CWinThread* m_PrintThread;

	DWORD WriteEscapeToPrinter( 	char* pBuf,  // array that contains printer data
								DWORD cbBuf);  // size, in bytes, of array
	void DisplayLastError(DWORD LastError);

// Dialog Data
	//{{AFX_DATA(CMonitor2Dlg)
	enum { IDD = IDD_MONITOR2_DIALOG };
	CButton	m_cbPrint;
	CProgressCtrl	m_cKillStat;
	CListBox	m_clStatusCode;
	CButton	m_cbAutoStatus;
	CListBox	m_clStatus;
	CString	m_csErrorEvent;
	CString	m_csPrinter;
	CString	m_csStatus;
	CString	m_csStatusEvent;
	CString	m_csStatusCode;
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CMonitor2Dlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	HICON m_hIcon;

//	ITTPMonitorPtr  m_spITTPMonitor;
	ITTPStatusPtr	m_spITTPStatus;
	BOOL			bStatus, bPrint;
	DWORD			dSleepTime;

	// Generated message map functions
	//{{AFX_MSG(CMonitor2Dlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnGetStatus();
	afx_msg void OnAutoStatus();
	afx_msg void OnChangeStatus();
	afx_msg void OnSelchangeStatusList();
	afx_msg void OnIdBmCal();
	afx_msg void OnIdSelectPrinter();
	afx_msg void OnIdSleepTime();
	afx_msg void OnMenuexit();
	afx_msg void OnAboutbox();
	afx_msg void OnPrint();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_MONITOR2DLG_H__F487C981_391D_475A_9939_939FF61E9B24__INCLUDED_)
