Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. display bitmap on a control botton.

display bitmap on a control botton.

Scheduled Pinned Locked Moved C / C++ / MFC
helpgraphicsquestionannouncementlearning
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    Ibana
    wrote on last edited by
    #1

    Hi there ! Im stuck with my win32 application where I want to add an bitmap to a control button in a dialog., Im tryin to use the BM_SETIMAGE message but I dont get it to work... I have a bitmap IDB_BACKWARD_BITMAP defined in the resource.rc and given an id in resource.h The control button IDC_BUTTON1 that I want to attach the image to is defined in the resource.rc here is my callback function for the dialog window that also contains an combobox etc but its not displayed here. LRESULT CALLBACK ToolboxProc(HWND hWndDlg, UINT Msg, WPARAM wParam, LPARAM lParam) { LRESULT iComboBoxSelection; switch(Msg) { case WM_INITDIALOG: SendMessage(GetDlgItem(hWndDlg,IDC_BUTTON1), BM_GETIMAGE, IMAGE_BITMAP, IDB_BACKWARD_BITMAP); .............. I have also tried a version where I load the bitmap like this; Bitmap=LoadBitmap(t_hInst,MAKEINTRESOURCE(IDC_BUTT ON1)); SendMessage(GetDlgItem(hWndDlg,IDC_BUTTON1), BM_GETIMAGE, IMAGE_BITMAP, Bitmap); Where I have defined HINSTACE t_hInst global but is there anything else that I have to do with it? and i also get an error "cannot convert parameter 4 from 'BITMAP' to 'LPARAM' ...... Any help would be grateful because I dont have any clue about what to do :) Regrads /Peter

    I 1 Reply Last reply
    0
    • I Ibana

      Hi there ! Im stuck with my win32 application where I want to add an bitmap to a control button in a dialog., Im tryin to use the BM_SETIMAGE message but I dont get it to work... I have a bitmap IDB_BACKWARD_BITMAP defined in the resource.rc and given an id in resource.h The control button IDC_BUTTON1 that I want to attach the image to is defined in the resource.rc here is my callback function for the dialog window that also contains an combobox etc but its not displayed here. LRESULT CALLBACK ToolboxProc(HWND hWndDlg, UINT Msg, WPARAM wParam, LPARAM lParam) { LRESULT iComboBoxSelection; switch(Msg) { case WM_INITDIALOG: SendMessage(GetDlgItem(hWndDlg,IDC_BUTTON1), BM_GETIMAGE, IMAGE_BITMAP, IDB_BACKWARD_BITMAP); .............. I have also tried a version where I load the bitmap like this; Bitmap=LoadBitmap(t_hInst,MAKEINTRESOURCE(IDC_BUTT ON1)); SendMessage(GetDlgItem(hWndDlg,IDC_BUTTON1), BM_GETIMAGE, IMAGE_BITMAP, Bitmap); Where I have defined HINSTACE t_hInst global but is there anything else that I have to do with it? and i also get an error "cannot convert parameter 4 from 'BITMAP' to 'LPARAM' ...... Any help would be grateful because I dont have any clue about what to do :) Regrads /Peter

      I Offline
      I Offline
      Ivan Cachicatari
      wrote on last edited by
      #2

      Hi, You can try with another alternative control to avoid more problems: Image Button Control - Codeproject[^] CImageButton - Latindevelopers.com[^] (spanish) use google or altavista to translate. Ivan Cachicatari www.latindevelopers.com

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups