?? openfile.h
字號:
#include "stdafx.h"
#include <stdio.h>
BYTE * OpenBMP(CString fileName,long *width,long *height)
{
BYTE * pData;
*width = 0;
*height = 0;
if(fileName=="")
return NULL;
BITMAPINFO bmpInfo;
BITMAPFILEHEADER bmpFileHead;
CFile file;
if((file.Open(fileName,CFile::modeRead|CFile::shareDenyNone))==NULL)
{
AfxMessageBox("Can not open the file");
return NULL;
}
file.Read(&bmpFileHead,sizeof(BITMAPFILEHEADER));
file.Read(&bmpInfo,sizeof(BITMAPINFOHEADER));
*width = bmpInfo.bmiHeader.biWidth;
*height = bmpInfo.bmiHeader.biHeight;
long lFileSize = bmpFileHead.bfSize - bmpFileHead.bfOffBits;
pData = (BYTE*)new char[lFileSize];
if(!pData)
return NULL;
file.ReadHuge(pData,lFileSize);
file.Close();
return pData;
}
BYTE * OpenRAW(CString fileName,long *width,long *height)
{
BYTE * pData;
if(fileName=="")
return FALSE;
*width = 352;
*height = 240;
long lFileSize = (*width) * (*height);
pData = (BYTE*)new char[lFileSize];
CFile file;
if((file.Open(fileName,CFile::modeRead|CFile::shareDenyNone))==NULL)
{
AfxMessageBox("Can not open the file");
return NULL;
}
if(!pData)
return NULL;
file.ReadHuge(pData,lFileSize);
file.Close();
return pData;
}
BYTE * OpenGRAY(CString fileName,long *width,long *height)
{
BYTE * pData;
if(fileName=="")
return FALSE;
*width = 360;
*height = 288;
long lFileSize = (*width) * (*height);
pData = (BYTE*)new char[lFileSize];
CFile file;
if((file.Open(fileName,CFile::modeRead|CFile::shareDenyNone))==NULL)
{
AfxMessageBox("Can not open the file");
return NULL;
}
if(!pData)
return NULL;
file.ReadHuge(pData,lFileSize);
file.Close();
return pData;
}
BYTE * OpenSIF(CString fileName,long *width,long *height)
{
BYTE * pData;
if(fileName=="")
return FALSE;
*width = 352;
*height = 240;
long lFileSize = (*width) * (*height);
pData = (BYTE*)new char[lFileSize];
CFile file;
if((file.Open(fileName,CFile::modeRead|CFile::shareDenyNone))==NULL)
{
AfxMessageBox("Can not open the file");
return NULL;
}
if(!pData)
return NULL;
file.ReadHuge(pData,lFileSize);
file.Close();
return pData;
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -