CBitmap problem
Could anyone out there help me fix this dorky program?
#include <iostream>
#include <fstream>
#include <afxwin.h>
#include <windows.h>
using namespace std;
void getres(int &height, int &width);
BOOL MyLoadBitmap (std::string szFilename);
int main (int argc, char *argv[])
{
int height, width;
//CImage image;
bool bbitmap;
std::string inputfilename = "test.bmp";
//ifstream inputfile (inputfilename.c_str());
bbitmap = MyLoadBitmap (inputfilename.c_str());
getres(height, width);
return 0;
}
void getres (int &height, int &width)
{
width = 640;
height = 480;
}
BOOL MyLoadBitmap(std::string szFilename)
{
// ASSERT(szFilename);
DeleteObject();
HBITMAP hBitmap = NULL;
hBitmap = (HBITMAP)LoadImage(NULL, (LPCSTR) szFilename.c_str(),
IMAGE_BITMAP, 0, 0,
LR_LOADFROMFILE | LR_CREATEDIBSECTION | LR_DEFAULTSIZE);
return Attach(hBitmap);
}
======================================
c:\Documents and Settings\Jacky.ETC-JACKY\LPR2.0\LPR2.0\lpr2_0.cpp(45):
error C2065: 'Attach' : undeclared identifier
c:\Documents and Settings\Jacky.ETC-JACKY\LPR2.0\LPR2.0\lpr2_0.cpp(40):
error C2660: 'DeleteObject' : function does not take 0 parameters
c:\Documents and Settings\Jacky.ETC-JACKY\LPR2.0\LPR2.0\lpr2_0.cpp(20):
warning C4800: 'BOOL' : forcing value to bool 'true' or 'false' (performance
warning)
Thanks in advance
Jack