How to put a standard windows icon on a button

Posted on 2004-11-09
Last Modified: 2013-11-20
How do I put a stardard windows icon on a button?

I have a dlg based application and want to put the 'browse folders' icon on a button.

Question by:galneweinhaw
    1 Comment
    LVL 43

    Accepted Solution

    CButton myButton;

    // Create an icon button.
    myButton.Create(_T("My button"), WS_CHILD|WS_VISIBLE|BS_ICON,
       CRect(10,10,60,50), pParentWnd, 1);

    // Set the icon of the button to be the system question mark icon.
    myButton.SetIcon( ::LoadIcon(NULL, IDI_QUESTION) );

    You will have to create your own icon which is a 'copy' of the picture on the browse folders icon and load it onto the button as per above code.  (You can also create the button in the resource editor and set the style there as icon).

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
    If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
    This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now