Sunday, May 10, 2009

How Catch Events For Bitmap Using Win32 API & C++ (No MFC)?

please Show how i can catch events for a bitmap image without MFC.


ONLY win32 api


ONLY c++





Thanks

How Catch Events For Bitmap Using Win32 API %26amp; C++ (No MFC)?
What do you mean catch events with Bitmaps? First of all whenever you need to catch events, you would need the pointer of the location you wish to cause that event.





So you would need the pointer to that bitmap (I don't know if any event would help here)





But if you wish to find the pointer of the Bitmap you could use this function.


// Loads A Bitmap Image


AUX_RGBImageRec *LoadBMP(char *Filename) {


// File Handle


FILE *File=NULL;


// Make Sure A Filename Was Given


if (!Filename)


{


// If Not Return NULL


return NULL;


}


// Check To See If The File Exists


File=fopen(Filename,"r");


if (File) // Does The File Exist?


{


// Close The Handle


fclose(File);


// Load The Bitmap And Return A Pointer


return auxDIBImageLoad(Filename);


}


// If Load Failed Return NULL


return NULL;


}





The above function will return a pointer to that image using the normal C++ library... What you would do later is if the image is loaded or whatever you choose from you just pass that pointer to your application. You would need to create callbacks to handle the function pointers that will accept that pointer.


No comments:

Post a Comment