📄 resorgversioncheck.h
字号:
#ifndef __ResOrgVersionCheck_H__
#define __ResOrgVersionCheck_H__
/************************************************************************
*
* CResOrgVersionCheck - a class to check for new versions
* of ResOrg via the Internet
*
* Written by Andy Metcalfe (andy.metcalfe@lineone.net)
*
************************************************************************
*
* Filename : ResOrgVersionCheck.h
*
* Compiler : Microsoft Visual C++ 6.0, Service Pack 3 or 4
*
* Target
* Environment : Windows 98/NT (not tested on '95, Me and 2000,
* but it should work on them too)
*
* NOTE:
*
* Your may freely to use this code in your own products, PROVIDED
* this notice is not removed or modified.
*
************************************************************************/
// ResOrgVersionCheck.h : header file
//
#include <afxmt.h>
/////////////////////////////////////////////////////////////////////////////
// CResOrgVersionCheck class
#define CResOrgVersionCheck_BASE CObject
class RESORGUTILS_EXT_CLASS CResOrgVersionCheck : public CObject
{
// Construction
public:
CResOrgVersionCheck(BOOL bDisableDialupPrompt);
virtual ~CResOrgVersionCheck(void);
// Attributes
protected:
CString m_sURL;
CString m_sTempFileName; // Temporary file
DWORD m_dwContext;
int m_ePriority;
BOOL m_bDisableDialupPrompt;
DWORD m_dwErrorCode;
HWND m_hwndTarget; // Target window for notification
UINT m_uMsg; // User defined message to post
UINT m_uMsgID; // ID if message is WM_COMMAND
CEvent m_Event; // Event used to signal thread to exit
CWinThread* m_pThread; // Pointer to worker thread monitoring file
HANDLE m_hThread; // Thread handle obtained from m_pThread
static CMapPtrToPtr m_mapMonitors; // Used to call into the right object from
// static callback function
// Virtual Overrides
protected:
// Called when a notification should be made
virtual BOOL OnDownloadCompleted(void);
// Operations
public:
BOOL SetNotifyTarget( CWnd* pWnd,
UINT uMsg,
UINT uID = 0);
BOOL SetPriority(int ePriority);
BOOL StartDownload( const CString& sURL,
DWORD dwContext = 0);
BOOL IsDownloading(void) const
{ return (NULL != m_pThread); }
DWORD GetErrorCode(void) const
{ return m_dwErrorCode; }
CString GetURL(void) const
{ return m_sURL; };
CString GetValue( const CString& sSection,
const CString& sEntry,
const CString& sDefault = _T("") ) const;
BOOL IsNewVersion( const CString& sSection,
const CString& sExistingVer) const;
BOOL DownloadTextFile( const CString& sURL,
const CString& sDestination,
DWORD dwContext,
DWORD* pdwError = NULL);
// Implementation
private:
// Create worker thread
BOOL CreateDownloadThread(void);
// Main function for worker thread. Called when the thread is created
static UINT ThreadFunc(LPVOID pParam);
UINT DoThreadFunc(LPVOID pParam);
};
/////////////////////////////////////////////////////////////////////////////
#endif //!__ResOrgVersionCheck_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -