main.~h

来自「MTK手机开发工具软件,可以从电脑上下载文件到手机存储空间.在软件开发过程中,当」· ~H 代码 · 共 128 行

~H
128
字号
//---------------------------------------------------------------------------

#ifndef mainH
#define mainH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ComCtrls.hpp>
#include <ToolWin.hpp>
#include <Buttons.hpp>
#include <SyncObjs.hpp>
#include <ExtCtrls.hpp>
#include <Dialogs.hpp>
#include "CGAUGES.h"
#include <vector>
#include <list>


class Meta_com;


class CS_Sentry {
public:
	CS_Sentry(TCriticalSection  *cs):m_cs(cs) { m_cs->Acquire(); }
    ~CS_Sentry() { m_cs->Release(); }
private:
	TCriticalSection	*m_cs;
};


class DownloadBinFile {
public:
	DownloadBinFile() {
		m_Filepath = "";
        m_AliasName = "";
		m_Enable = true;
        m_Size = 0;
	}

	~DownloadBinFile() { }

    DownloadBinFile( const DownloadBinFile& r_value )
    {
        m_Filepath = r_value.m_Filepath;
        m_AliasName = r_value.m_AliasName;
        m_Enable = r_value.m_Enable;
        m_Size = r_value.m_Size;
    }

	bool operator == (const DownloadBinFile	&r_value)
    {
		if( 0==m_Filepath.AnsiCompareIC(r_value.m_Filepath) ||
			0==m_AliasName.AnsiCompareIC(r_value.m_AliasName)
		) {
			return true;
		}
		return false;
	}

	AnsiString		m_Filepath;
    AnsiString      m_AliasName;
	bool			m_Enable;
    unsigned int    m_Size;
};

//typedef std::list<DownloadBinFile>    DownloadFileList;
typedef std::vector<DownloadBinFile>    DownloadFileList;



//---------------------------------------------------------------------------
class TMainForm : public TForm
{
__published:	// IDE-managed Components
        TCoolBar *CoolBar1;
        TListView *ListView1;
        TStatusBar *StatusBar1;
    TPanel *Panel1;
    TSpeedButton *m_btnExit;
    TSpeedButton *m_btnAbout;
    TSpeedButton *m_btnDownload;
    TSpeedButton *m_btnRemove;
    TSpeedButton *m_btnAdd;
    TComboBox *ComboBox1;
    TOpenDialog *OpenDialog1;
    TTimer *Timer1;
    TCGauge *CGauge1;
    TEdit *Edit1;
        void __fastcall m_btnExitClick(TObject *Sender);
        void __fastcall m_btnAboutClick(TObject *Sender);
        void __fastcall m_btnDownloadClick(TObject *Sender);
    void __fastcall FormCreate(TObject *Sender);
    void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
    void __fastcall FormDestroy(TObject *Sender);
    void __fastcall m_btnRemoveClick(TObject *Sender);
    void __fastcall m_btnAddClick(TObject *Sender);
    void __fastcall Timer1Timer(TObject *Sender);
    void __fastcall ListView1Change(TObject *Sender, TListItem *Item,
          TItemChange Change);
    void __fastcall ComboBox1Change(TObject *Sender);
private:	// User declarations
    bool m_InLVUpdate;
public:
    Meta_com* m_tskMetaCom;

    unsigned short m_COMPortList[256];
    unsigned short m_COMPortCount;
    unsigned int m_nComPort;
    int m_nBaudRate;
    
    TCriticalSection* m_pUpdateListLock;

    DownloadFileList    m_FilesList;
    unsigned int m_nFilesCount;
    unsigned int m_nProgressTimeSec;
    unsigned int m_nCostTimeSec;

    __fastcall TMainForm(TComponent* Owner);
    void __fastcall RedrawDownloadList(void);
    void __fastcall EnableCtrls(void);
};
//---------------------------------------------------------------------------
extern PACKAGE TMainForm *MainForm;
//---------------------------------------------------------------------------
#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?