001:
002:
003:
004: #if !defined(AFX_CTPUZZLEDLG_H__4309079D_C92E_4B33_AFED_393A7CF8836E__INCLUDED_)
005: #define AFX_CTPUZZLEDLG_H__4309079D_C92E_4B33_AFED_393A7CF8836E__INCLUDED_
006:
007: #if _MSC_VER > 1000
008: #pragma once
009: #endif
010:
011: #include "UKPuzzleAdmin.h"
012:
013:
014:
015: class CCTPuzzleDlg : public CDialog
016: {
017:
018: public:
019: CCTPuzzleDlg(CWnd* pParent = NULL);
020:
021:
022:
023: enum { IDD = IDD_CTPUZZLE_DIALOG };
024: CString m_strPastTime;
025: CString m_strSolutions;
026: CString m_strSolutionsPerSecond;
027: CString m_strSolutionsPerSecond2;
028:
029:
030:
031:
032: protected:
033: virtual void DoDataExchange(CDataExchange* pDX);
034:
035:
036: public:
037: BOOL PrepareDialog(LPCTSTR szCfgFileName){m_strInCfgFileName=szCfgFileName;return TRUE;}
038:
039:
040: protected:
041: HICON m_hIcon;
042:
043:
044:
045: virtual BOOL OnInitDialog();
046: afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
047: afx_msg void OnPaint();
048: afx_msg HCURSOR OnQueryDragIcon();
049: virtual void OnOK();
050: virtual void OnCancel();
051: afx_msg void OnStop();
052: afx_msg void OnStart();
053: afx_msg void OnPause();
054: afx_msg void OnContinue();
055: afx_msg void OnCloseDialog();
056: afx_msg void OnClose();
057: afx_msg void OnTimer(UINT nIDEvent);
058: afx_msg void OnLoadConfig();
059:
060: afx_msg LRESULT OnUKWrite(WPARAM, LPARAM);
061: afx_msg LRESULT OnUKNotify(WPARAM, LPARAM);
062: afx_msg void OnUpdateButtonStop(CCmdUI* pCmdUI);
063: afx_msg void OnUpdateButtonStart(CCmdUI* pCmdUI);
064: afx_msg void OnUpdateButtonPause(CCmdUI* pCmdUI);
065: afx_msg void OnUpdateButtonContinue(CCmdUI* pCmdUI);
066: afx_msg void OnUpdateLoadConfig(CCmdUI* pCmdUI);
067: DECLARE_MESSAGE_MAP()
068:
069: protected:
070: void __cdecl Write(LPCTSTR strText,...);
071: void __cdecl WriteLn(LPCTSTR strText,...);
072:
073:
074:
075: BOOL InitThreads();
076: void DeinitThreads();
077: BOOL m_bAdminVectorIsInit;
078:
079: long m_nThreadCount;
080: long m_nMaxActiveThreads;
081: long m_nActiveThreads;
082:
083: struct SUKAdminThread
084: {
085: SUKAdminThread(CWnd* pWnd,long nFirstStoneOnPos_0=-1,long nLastStoneOnPos_0=-1,LPCTSTR szIniFileName="",LPCTSTR szOutputFileName="")
086: :theThread(pWnd,nFirstStoneOnPos_0,nLastStoneOnPos_0,szIniFileName,szOutputFileName),
087: bWasStarted(FALSE),
088: bWasFinished(FALSE),
089: nResultCount(0){}
090:
091: CUKPuzzleAdmin theThread;
092:
093: BOOL bWasStarted;
094: BOOL bWasFinished;
095:
096: long nResultCount;
097: };
098: SUKAdminThread **m_pPuzzleAdminVector;
099:
100:
101: UINT m_nTimerID1;
102: UINT m_nTimerID2;
103:
104: long m_nState;
105: DWORD m_nTimerStart;
106: DWORD m_nElapsedTime;
107:
108:
109: enum {enSolutionAveraging=100};
110: long m_nItemCount;
111: long m_nLastItem;
112: DWORD m_nLastResultCount[enSolutionAveraging];
113: DWORD m_nLastResultTime[enSolutionAveraging];
114:
115: CString m_strConfigFileName;
116: CString m_strOutputFileNameBase;
117:
118:
119: CString m_strInCfgFileName;
120:
121: TCHAR m_szPrompt[16];
122: };
123:
124:
125:
126:
127: #endif