⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fsview.cpp

📁 fat file system api in VC
💻 CPP
字号:
// FSView.cpp : implementation of the CFSView class
//

#include "stdafx.h"
#include "FS.h"
#include "Hide_FAT32.h"

#include "FSDoc.h"
#include "FSView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CFSView

IMPLEMENT_DYNCREATE(CFSView, CView)

BEGIN_MESSAGE_MAP(CFSView, CView)
	//{{AFX_MSG_MAP(CFSView)
	//}}AFX_MSG_MAP
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CFSView construction/destruction

CFSView::CFSView()
{
	// TODO: add construction code here
}

CFSView::~CFSView()
{
}

BOOL CFSView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CFSView drawing

void CFSView::OnDraw(CDC* pDC)
{
	CFSDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
/*	CHAR sPath[]="M:\\h\\h.txt",sPath2[]="M:\\TestLongFileName\\ThisTxtUsedTo Test.txt";

	DPB dpb;
	pFat->GetDPB(dpb);
	DIRINCLU DirEnt;
    TRACE("In OnDraw: %d\n",sizeof(sPath));
	pFat->GetEntryAddr(sPath,DirEnt);
	Directory_FAT EntryContent;
	pFat->GetEntryContent(sPath,EntryContent);
	BPB_FAT bpb;
	pFat->GetSpecificBPB(bpb);
	pFat->GetFirstSecOfClu(bpb.RootEntry);
	CHAR* buffer=new CHAR[pFat->GetClusterSize()];
	if(!buffer)
	{
		TRACE("Error!\n");
	}
	pFat->ReadCluster(2,buffer);
	ABS_SEC_BUF buffer2;
	pFat->ReadSector(0,buffer2);
	FAT_BUF buffer3;
	INT SectorNum=bpb.ReservedSectors;
	pFat->ReadFAT(SectorNum,buffer3);
	//success up

    Hide_FAT32* pHide=new Hide_FAT32(sPath);
	if(!pHide)
	{
		TRACE("Construct Error!");
	}
	pHide->Hide();
	pHide->Show();
/*/
}

/////////////////////////////////////////////////////////////////////////////
// CFSView printing

BOOL CFSView::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default preparation
	return DoPreparePrinting(pInfo);
}

void CFSView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add extra initialization before printing
}

void CFSView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// CFSView diagnostics

#ifdef _DEBUG
void CFSView::AssertValid() const
{
	CView::AssertValid();
}

void CFSView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

CFSDoc* CFSView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CFSDoc)));
	return (CFSDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CFSView message handlers

⌨️ 快捷键说明

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