Files
HLStock/CheckServer/WebReloadThread.h
2013-07-20 23:25:45 +00:00

74 lines
2.5 KiB
C++

#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 <afxinet.h>
#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_)