TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: jari laaksonen
from: Johan Siegers
date: 1995-02-28 11:14:12
subject: Button with BS_ICON style

Hi jari,

 jl> I have a button with BS_ICON style. How can I change its icon at runtime?

I'm not sure if it will work for buttons, but the next example works for
Bitmaps/Icons which are in the Dialog:

void UpdateLeds(HWND hwnd, int LedType)
{
    HPS     hps;
    HWND    hwndBmp;
    int     i;
    hps = WinGetPS( hwnd );
    // Load the 4 LED bitmaps
    hbm[0] = GpiLoadBitmap( hps, NULLHANDLE, LED_NEUTRAL, 12, 12 );
    hbm[1] = GpiLoadBitmap( hps, NULLHANDLE, LED_OK, 12, 12 );
    hbm[2] = GpiLoadBitmap( hps, NULLHANDLE, LED_ERR, 12, 12 );
    hbm[3] = GpiLoadBitmap( hps, NULLHANDLE, LED_YELLOW, 12, 12 );

    hwndBmp = WinWindowFromID( hwnd, LedID );
    WinSendMsg( hwndBmp, SM_SETHANDLE, MPFROMP( hbm[LedType] ), NULL );

    for(i=0; i<4; i++) GpiDeleteBitmap( hbm[i] );
    WinReleasePS( hps );    
}

Bye, Johan.

--- The-Box Point 0.15+ PC
* Origin: johan{at}bitbike.iaf.nl - CIS: 100120,2502 (2:283/512.16)
SEEN-BY: 105/42 620/243 624/50 711/401 409 410 413 430 807 808 809 934 942
SEEN-BY: 711/955 712/407 515 628 704 713/888 800/1 7877/2809
@PATH: 283/512 280/801 24/24 396/1 3615/50 105/103 42 712/515 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.