|
HBITMAP? Anonymous |
16 year
|
How would you go about changing the HBITMAP file, you get from using the getBitmap function, into a normal Image or Bitmap file in visual c++?
|
|
|
Anonymous |
16 year
|
Im using the following code:
Bitmap^ bitmaps;
HBITMAP ashir = rr.getBitmap("processed", image, &width, &height,width*height*3);
GetObject(ashir, sizeof(BITMAP),&bitmaps);
return bitmaps;
Im really not sure how to deal with a HBITMAP since visual c++ seems to cater for the hbitmap class and not HBITMAP. When i run this code the program crashes and windows closes it down (offering to send details of the bug to Microsoft)
|
|
|
Anonymous |
16 year
|
|
|
Anonymous |
16 year
|
I dont know about Cbitmaps I just use the Bitmap and Image classes from the System::Drawing library. I mention hbitmap because the Image function in visual c++ allows for an image to be taken from an hbitmap file using the Image->Fromhbitmap function.
|
|
|
Anonymous |
16 year
|
|
|
Anonymous |
16 year
|
That kind of confuses me more. I have this code so far:
Bitmap^ bitmaps;
HBITMAP hbitmap = (rr.getBitmap("processed", image, &width, &height,width*height*3));
Image^ tester=Image::FromHbitmap(hbitmap);
This gives me the error:
error C2665: 'System::Drawing::Image::FromHbitmap' : none of the 2 overloads could convert all the argument types.
Is there a simple way to take the HBITMAP and change it into a bitmap? It sounds elementary but I just dont have a clue on how to do it. I dont know what an HBITMAP is strictly speaking...
|
|
|
Anonymous |
16 year
|
Has anyone else got the getBitmap function working? Have you been able to save the HBITMAP into a normal bitmap file?
|
|
|
Anonymous |
16 year
|
Made further changes to the code:
Bitmap^ bitmaps;
HBITMAP hbitmap = rr.getBitmap("processed", image, &width, &height,width*height*3);
GetObject(hbitmap, sizeof(hbitmap), &bitmaps);
return bitmaps;
Im trying to get the HBITMAP and allocate it into a Bitmap^ variable but when I do this and step through the program the value returned for "hbitmap" is zero and the Bitmap variable "bitmaps" returned has a value of "<undefined value>" is there something wrong with my code? Ive checked and the program steps through the whole of the getBitmap function and returns "hbitmap" from within the function but this doesnt have a value either.
|
|
|
Anonymous |
16 year
|
I found a way to get a bitmap from the HBITMAP you get using getBitmap. You use this line of coding:
HBITMAP hbmp;
...
Bitmap^ bmp = Image::FromHbitmap(IntPtr((int)hbmp));
|
|