Quote:Original post by dustydoodoo
Well then whats wrong with the destructor!?
I dont know. What errors are you getting? Maybe you should post the entire class.
Quote:Original post by dustydoodoo
Well then whats wrong with the destructor!?
Quote:Original post by dustydoodoo
Never mind!, this stupid Dev_c++ is messed up!! im not using it anymore!
class Bitmap{ private: bool BitmapLoaded; public: HBITMAP bitmap; unsigned short int x; unsigned short int y; ~Bitmap() { DeleteObject(bitmap); } void Load(LPSTR name) { bitmap = LoadBitmap(name); } //DB stands for Display Bitmap void DB(BUFFER *buffer, int x, int y) { DisplayBitmap(buffer, bitmap, x, y); } };
#include <windows.h>HINSTANCE g_hinstance;class Bitmap{ private: bool BitmapLoaded; public: HBITMAP bitmap; unsigned short int x; unsigned short int y; // Deconstructor ~Bitmap() { if( BitmapLoaded ) DeleteObject( bitmap ); } // Constructor Bitmap() { BitmapLoaded = false; } void Load(LPSTR name) { // In this function, you need two parameters, the first is the HINSTANCE of the program // To get that you will need to save it from the: // int APIENTRY WinMain(HINSTANCE hinstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) bitmap = LoadBitmap( g_hinstance, name ); BitmapLoaded = true; } //DB stands for Display Bitmap I don't have this data so it's commented out /*void DB( BUFFER *buffer, int x, int y) { DisplayBitmap(buffer, bitmap, x, y); } */ }; int APIENTRY WinMain(HINSTANCE hinstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { // You will need to do this! g_hinstance = hinstance; return 0;}