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. Loading Icon in a Property Sheet Button

Loading Icon in a Property Sheet Button

Scheduled Pinned Locked Moved C / C++ / MFC
help
3 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.
  • M Offline
    M Offline
    Muhammad Ahmed 0
    wrote on last edited by
    #1

    hi: i am using the following code to load an icon for the ok button of the property sheet but this is not woking //////////////OnInitDialog////////////////////////////// BOOL CMyPropertySheet::OnInitDialog() { BOOL bResult = CPropertySheet::OnInitDialog(); // other code CButton* pButt=(CButton*)GetDlgItem(IDOK); CWinApp* pApp=AfxGetApp(); HICON hIcon=::LoadIcon(pApp->m_hInstance,MAKEINTRESOURCE(IDI_CLOSE)); if(hIcon==NULL) AfxMessageBox("null handle of icon"); pButt->SetIcon(hIcon); return bResult; } ///////////////////////////////////////////////////////// i cant see the icon ..can any one help me.... thanks Ahmed:( ahmed

    R 1 Reply Last reply
    0
    • M Muhammad Ahmed 0

      hi: i am using the following code to load an icon for the ok button of the property sheet but this is not woking //////////////OnInitDialog////////////////////////////// BOOL CMyPropertySheet::OnInitDialog() { BOOL bResult = CPropertySheet::OnInitDialog(); // other code CButton* pButt=(CButton*)GetDlgItem(IDOK); CWinApp* pApp=AfxGetApp(); HICON hIcon=::LoadIcon(pApp->m_hInstance,MAKEINTRESOURCE(IDI_CLOSE)); if(hIcon==NULL) AfxMessageBox("null handle of icon"); pButt->SetIcon(hIcon); return bResult; } ///////////////////////////////////////////////////////// i cant see the icon ..can any one help me.... thanks Ahmed:( ahmed

      R Offline
      R Offline
      Renjith Ramachandran
      wrote on last edited by
      #2

      Is Your porpertysheet in WIZARD MODE ???? CodeTheDreams();

      M 1 Reply Last reply
      0
      • R Renjith Ramachandran

        Is Your porpertysheet in WIZARD MODE ???? CodeTheDreams();

        M Offline
        M Offline
        Muhammad Ahmed 0
        wrote on last edited by
        #3

        hi: the issue is solved it should have been like CButton* pButt=(CButton*)GetDlgItem(IDOK); DWORD newstyle = ::GetWindowLong(pButt->m_hWnd, GWL_STYLE) | BS_ICON; ::SetWindowLong(pButt->m_hWnd, GWL_STYLE, newstyle); CWinApp* pApp=AfxGetApp(); HICON hIcon=::LoadIcon(pApp->m_hInstance,MAKEINTRESOURCE(IDI_CLOSE)); if(hIcon==NULL)AfxMessageBox("null icon"); pButt->SetIcon(hIcon); return bResult;:) thanks ahmed

        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