anybody...?

This is a discussion on anybody...? within the C++ Programming forums, part of the General Programming Boards category; Has anybody got any simple code (or got a link to it) of just a normal window that displays a ...

  1. #1
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052

    Thumbs up anybody...?

    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
    Please direct all complaints regarding this post to the nearest brick wall Have a nice day.

  2. #2
    Registered User wayko's Avatar
    Join Date
    Sep 2001
    Posts
    28
    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

  3. #3
    Registered User alex6852's Avatar
    Join Date
    Sep 2001
    Posts
    43
    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!!!

  4. #4
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,825
    You could always try the tuts at Sunlight's site

  5. #5
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    using Microsoft Visual C++ 6.0 Standard Edition, how do you load a bitmap into a diologe or something like that?
    Please direct all complaints regarding this post to the nearest brick wall Have a nice day.

  6. #6
    Registered User wayko's Avatar
    Join Date
    Sep 2001
    Posts
    28

    Talking

    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

  7. #7
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    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.

  8. #8
    Registered User
    Join Date
    Oct 2001
    Posts
    43

    jpeg & gif

    I have found a source code for MSVC++ which opens these formats:

    www.codeguru.com

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21