Icons and Buttons in Win32 API

This is a discussion on Icons and Buttons in Win32 API within the Windows Programming forums, part of the Platform Specific Boards category; Is there an easy way to use an icon as the caption of a button. When using Visual C++ 6.0, ...

  1. #1
    Quietly Lurking
    Join Date
    Aug 2001
    Posts
    208

    Icons and Buttons in Win32 API

    Is there an easy way to use an icon as the caption of a button.
    When using Visual C++ 6.0, when designing a dialog, the properties menu for a pushbutton gives you the option to check a box with the title icon, which I assumed would allow you to do this, but i dont know how to tell it which icon to use. Any help would be appreciated

  2. #2
    Registered User ExDigit's Avatar
    Join Date
    Jan 2002
    Posts
    31
    Try something like this:

    SendDlgItemMessage(hWnd, IDC_BUTTON1, WM_SETICON, (WPARAM)ICON_SMALL, (LPARAM)(HICON)LoadIcon(hInstance, MAKEINTRESOURCE(IDI_MYICON)));

    Basically sending the WM_SETICON message to the button. I haven't tested this, but it may work.
    Win32 API C
    Bloodshed Dev-C++ Beta 5
    Microsoft Windows 2000 Pro

    http://www.cdsoft.co.uk/

  3. #3
    Quietly Lurking
    Join Date
    Aug 2001
    Posts
    208
    Heh, it took some time searching through MSDN, but I found the answer. You were really close, instead of sending WM_SETICON you send BM_SETIMAGE

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Putting tool buttons onto windows
    By eth0 in forum Windows Programming
    Replies: 7
    Last Post: 04-10-2006, 04:15 PM
  2. Clipart for Toolbar Buttons?
    By Davros in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 02-24-2006, 09:23 AM
  3. Windows XP - File Types and Icons
    By LuckY in forum Tech Board
    Replies: 7
    Last Post: 05-18-2005, 04:35 PM
  4. Icons???
    By gvector1 in forum C# Programming
    Replies: 3
    Last Post: 12-15-2003, 12:03 AM

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