Files
AppUpgrade/UpgradeThread.h
2026-07-13 10:02:53 +08:00

63 lines
1.8 KiB
C++

//---------------------------------------------------------------------------
#ifndef UpgradeThreadH
#define UpgradeThreadH
//---------------------------------------------------------------------------
#define UM_SHOWTEXT WM_USER+0x1000
#define UM_PROGRESS WM_USER+0x1001
#define UM_COMPLETE WM_USER+0x1003
#define ERROR_OPEN_FILE 10
#define ERROR_MEMORY 11
#define ERROR_SIZE 12
#define ERROR_INTERNET_OPEN 13
#define ERROR_INTERNET_CONN 14
#define ERROR_INTERNET_REQ 15
#define ERROR_INTERNET_SEND 16
#define ERROR_FILELIST_GET 17
#define ERROR_FILE_SIZE 18
//---------------------------------------------------------------------------
class TUpgradeThread : public TThread
{
private:
int m_iMode,
m_idSoft;
HWND m_hWnd;
HANDLE m_hSema;
TStringList* m_lstMD5;
bool m_bUpdateSelf; //ÊÇ·ñ¸üÐÂ×ÔÉí
String m_AppPath,
m_PathName,
m_Server,
m_UpdateUrl,
m_GlobalFile;
bool __fastcall MakeMD5File();
bool __fastcall GetFileList(TStringList* pList);
bool __fastcall GenerateFileMD5( String fname, String& md5 );
String __fastcall GetUpdateMD5File();
int __fastcall GetUpdateFileList( String ufile, TStringList* pList );
int __fastcall DownloadFile( String url, String filename );
String __fastcall GetUpdateURL();
int __fastcall GetServers( TStringList* pList );
int __fastcall RegUpdateFlag( int iUpdate );
int __fastcall ClearUpdateDir();
bool __fastcall UpdateFiles();
int __fastcall RestartApp();
bool __fastcall StopApp();
bool __fastcall SameModulePath(DWORD dwPID);
protected:
void __fastcall Execute();
public:
TStringList* m_lstFile;
__fastcall TUpgradeThread(bool CreateSuspended, int mode, int sid, String sVar, HWND hWnd=NULL );
void __fastcall Cancel();
};
//---------------------------------------------------------------------------
#endif