Results 1 to 4 of 4

Thread: displaying bitmap on a static control

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800

    displaying bitmap on a static control

    I've been looking at some API's recently, but haven't successfully been able to display a bitmap on a static control. Any ideas how to do it? my main goal is the easiest way possible to display an image

  2. #2

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    im basically looking to load a bmp file without using resource files....LoadImage seems to be key, but I don't know where to go from there...can anyone help?

  3. #3
    Lively Member
    Join Date
    May 2002
    Location
    Oregon
    Posts
    64
    After load image you have to send the STM_SETIMAGE message to the control. The wParam should be IMAGE_BITMAP and the lParam should be the handle.

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Code:
    HBITMAP hbm = (HBITMAP)LoadImage(NULL, szFileName,
      IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
    if(hbm == NULL)
    {
      // error
    }
    // SS_BITMAP style must be set for the static control
    SendMessage(hwndStatic, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hbm);
    InvalidateRect(hwndStatic, NULL, TRUE);
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width