diff --git a/CheckServer/WebReloadThread.h b/CheckServer/WebReloadThread.h new file mode 100644 index 0000000..e06a669 --- /dev/null +++ b/CheckServer/WebReloadThread.h @@ -0,0 +1,73 @@ +#if !defined(AFX_WEBRELOADTHREAD_H__FE7A158A_B40D_4959_A64E_3D3053FEA4DD__INCLUDED_) +#define AFX_WEBRELOADTHREAD_H__FE7A158A_B40D_4959_A64E_3D3053FEA4DD__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// WebReloadThread.h : header file +// +#include + +#define PAGE_READMAX 12000 // ù¸Ó¸® °ø½Ã µ¥ÀÌÅͰ¡ ÀÖ´Â °÷±îÁö ÆÄÀÏÅ©±â. ´ë·« 10k~11k + +///////////////////////////////////////////////////////////////////////////// +// CWebReloadThread thread +class CMainFrame; +class CWebReloadThread : public CWinThread +{ + DECLARE_DYNCREATE(CWebReloadThread) +protected: + CWebReloadThread(); // protected constructor used by dynamic creation + +// Attributes +public: + bool DoContinuous( char* pchar ) { return( CWinThread::PostThreadMessage( tm_CWebReloadThreadOnDoContinuous, (WPARAM) pchar, NULL ) ? true : false ); } + void RegisterParent( CMainFrame* pCMainFrame ) { m_pCMainFrame = pCMainFrame; } + bool StopContinuous( void ) { return( ::SetEvent( m_hStopEvent ) ? true : false ); } + bool Quit( void ) { return( StopContinuous( ) && CWinThread::PostThreadMessage( WM_QUIT, NULL, NULL ) ? true : false ); } + + void SetURL( CString strURL[] ) { for(int i=0;i<2;i++){m_strURL[i]=strURL[i]; m_strURL[i].TrimLeft(); m_strURL[i].TrimRight();} } +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CWebReloadThread) + public: + virtual BOOL InitInstance(); + virtual int ExitInstance(); + //}}AFX_VIRTUAL + +private: + BOOL WebReload( HINTERNET hInternet, char * szUrl, BOOL &bFirst, CString &strNews ); + BOOL PageParser(char * szBody, BOOL &bFirst, CString &strNews); + + char m_szPageData[ 102400 + 1024 ]; + CString m_strURL[2]; + BOOL m_bFirst[2]; + CString m_strNews[2]; + CString m_strError; + +// Implementation +protected: + virtual ~CWebReloadThread(); + + static UINT tm_CWebReloadThreadOnDoContinuous; + CMainFrame* m_pCMainFrame; + HANDLE m_hStopEvent; + + // Generated message map functions + //{{AFX_MSG(CWebReloadThread) + // NOTE - the ClassWizard will add and remove member functions here. + afx_msg void OnDoContinuous( WPARAM wParam, LPARAM lParam ); + //}}AFX_MSG + + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_WEBRELOADTHREAD_H__FE7A158A_B40D_4959_A64E_3D3053FEA4DD__INCLUDED_)