Tab4.h
资源名称:OSDemo [点击查看]
上传用户:tianjwyx
上传日期:2007-01-13
资源大小:813k
文件大小:4k
源码类别:
操作系统开发
开发平台:
Visual C++
- #if !defined(AFX_TAB4_H__4FF42A0D_E850_4414_A03D_A7A76DEBB577__INCLUDED_)
- #define AFX_TAB4_H__4FF42A0D_E850_4414_A03D_A7A76DEBB577__INCLUDED_
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- // Tab4.h : header file
- //
- #define MAXFILE 20 //每个用户最多保存20个文件
- #define MAXUSER 10 //假想文件系统最多支持的人数
- #define BLOCKSIZE 32 //虚拟磁盘中物理块为每块32字节
- #define DISKSIZE BLOCKSIZE*1000 //虚拟磁盘容量为1000*32=32K VDISK.DAT=sizeof(FAT)+32K
- #include "DlgNewFile.h"
- #include "PieChartCtrl.h"
- #include "BalloonTip.h"
- /////////////////////////////////////////////////////////////////////////////
- // CTab4 dialog
- struct UFD
- {
- char FileName[15];
- char Time[16]; //文件建立或修改时间
- bool IsExist; //文件是否存在,删除时标为0
- bool IsShared; //共享标记,共享文件可被其它用户所访问
- bool AttrRead; //文件是否可读
- bool AttrWrite; //文件是否可写
- bool AttrExecute; //文件是否可执行
- HTREEITEM treeNode; //用于树控件显示的结点句柄
- USHORT FileLen; //文件占用字节数
- USHORT BlockNum; //文件占用的物理块数
- USHORT FileLink[100];//文件物理块地址数组,每块32字节,限定一个文件最大100*32=3200字节
- };
- struct MFD
- {
- char UserName[10]; //主目录用户名
- bool IsExist; //该用户否存在
- UFD ufd[MAXFILE]; //用户文件数组
- USHORT nItem;//UFD个数
- };
- struct HEADBLOCK
- {
- BYTE pStack; //堆栈指针
- SHORT pBlock[10]; //块号 pBlock[10]是下一个盘块号逻辑地址
- };
- struct BLOCK //虚拟磁盘的物理块数据结构
- {
- union{
- BYTE block[32];
- HEADBLOCK HeadInfo;
- };
- };
- struct FAT
- {
- BLOCK SuperBlock; //超级块,指示第一个空闲块逻辑号
- USHORT MaxOpen; //该用户同时可打开的最大文件数
- USHORT UserNum; //最户数
- MFD Mfd[MAXUSER]; //最多可支持10个用户
- };
- //空闲块成组链接法
- class CTab4 : public CDialog
- {
- // Construction
- public:
- void ShowBallTip(CPoint pt, CString msg);
- void ShowBlock(int fileid);
- bool ModifyFile(CString FileName, CString FileContent, bool AttrRead, bool AttrWrite, bool AttrExecute, bool AttrShare);
- int SelectPos;
- bool OpenList[MAXUSER][MAXFILE];
- CString SelectedFileName;
- CString ReadFile(CString FileName);
- bool CreateNewFile(CString FileName, CString FileContent, bool AttrRead, bool AttrWrite, bool AttrExecute,bool AttrShare);
- CString GetCurrentTime();
- bool KillFile(CString FileName);
- void ShowUserFiles();
- //bool WriteBlock(int id,BYTE *buffer);
- //bool ReadBlock(int id,BYTE* buffer);
- //bool FreeBlock(USHORT BlockID);
- //USHORT AllocBlock();
- void SetupImages(CImageList* mImageList, int iSize);
- void AddListFile(CString FName,CString FileOwn,CString FSize,CString Date,CString State,CString Attr);
- CTab4(CWnd* pParent = NULL); // standard constructor
- CImageList* TreeImageList;
- CImageList* m_pImageList;
- CImageList* m_pImageListL;
- // Dialog Data
- //{{AFX_DATA(CTab4)
- enum { IDD = IDD_TAB4 };
- CButton m_LoginBtn;
- CTreeCtrl m_FileTree;
- CListCtrl m_FileList;
- CString m_FileContent;
- //}}AFX_DATA
- // Overrides
- // ClassWizard generated virtual function overrides
- //{{AFX_VIRTUAL(CTab4)
- protected:
- virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
- //}}AFX_VIRTUAL
- // Implementation
- protected:
- CBalloonTip* m_pBalloonTip;
- CImageList m_cImageListNormal;
- CBrush m_bluebrush;
- COLORREF m_bluecolor,m_textcolor;
- // Generated message map functions
- //{{AFX_MSG(CTab4)
- virtual BOOL OnInitDialog();
- afx_msg void OnBtnLogin();
- afx_msg void OnBtnAdd();
- afx_msg void OnBtnModify();
- afx_msg void OnBtnUser();
- afx_msg void OnBtnDelete();
- afx_msg void OnBtnDisk();
- afx_msg void OnBtnClose();
- afx_msg void OnBtnOpen();
- afx_msg void OnClickFilelist(NMHDR* pNMHDR, LRESULT* pResult);
- afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
- private:
- bool AddFile(CString Path, CString FName, int FSize,CString Attr);
- void InitFileTree();
- void InitFileList();
- UINT ItemCount;
- };
- //{{AFX_INSERT_LOCATION}}
- // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
- #endif // !defined(AFX_TAB4_H__4FF42A0D_E850_4414_A03D_A7A76DEBB577__INCLUDED_)