Has anybody got any simple code (or got a link to it) of just a normal window that displays a bitmap image? I have tryed the faq several times but can't make sense of it...
Thanks
-Chris
Has anybody got any simple code (or got a link to it) of just a normal window that displays a bitmap image? I have tryed the faq several times but can't make sense of it...
Thanks
-Chris
Let see first let try to figure out what you are using...
if you are using visual c++ i might be able to help
if not i am still in the same boat as you
hello its me Wayko
I haven't checked it yet but probably that would help somehow.
//**************************************
//
// Name: Load a BMP from a file
// Description:This is a simple, easy to
// use function that shows how to load a bi
// tmap from a file then bitblit it to a wi
// ndow.
// By: Alex
//
//This code is copyrighted and has// limited warranties.Please see http://
// www.Planet-Source-Code.com/xq/ASP/txtCod
// eId.2579/lngWId.3/qx/vb/scripts/ShowCode
// .htm//for details.//**************************************
//
//load bmp
int LoadBitmapFile(char* FileName, int x, int y, HWND hwnd)
{
BITMAP bm;
HDC hdc = GetDC(hwnd);
BitHandle = (HBITMAP)LoadImage(NULL, FileName, IMAGE_BITMAP, 0,0, LR_LOADFROMFILE);
if(BitHandle == NULL)
{
MessageBox(0, "Error loading the specified bitmap", "Program Error!",
MB_ICONERROR | MB_SYSTEMMODAL | MB_OK);
}
HDC dc = CreateCompatibleDC(hdc);
SelectObject(dc, BitHandle);
GetObject(BitHandle, sizeof(BITMAP), &bm);
BitBlt(hdc, x, y, bm.bmWidth, bm.bmHeight, dc, 0,0, SRCCOPY);
ReleaseDC(hwnd, hdc);
return(0);
}
/* to load a bmp simple call the function as follows : LoadBitmapFile("bitmap.bmp",50,50,hwnd);
hope this helps */
C++ rulez!!!
You could always try the tuts at Sunlight's site
-Govtcheez
[email protected]
using Microsoft Visual C++ 6.0 Standard Edition, how do you load a bitmap into a diologe or something like that?
at the resource area right click the resource folder goto insert click on bitmap and press new (if you going to make your own) or import to add a ready made bitmap.
to add that new bitmap double click the dialog box double click the IDD_name of project_DIALOG then add a picture. right click on it and goto properties. on the type area choose bitmap and on the image area choose the bitmap you made or imported.
so far i am only allowed to work with icon and bitmaps still working on how to get gif and jpegs. if you find out how let me know
hello its me Wayko
Win32 does not have native support for .GIF or .JPEG files. You can get third party components which may solve your problem.
Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.
I have found a source code for MSVC++ which opens these formats:
www.codeguru.com