Re: Make button on commandbar unclickable by liyuhua
liyuhua
Fri Nov 14 17:06:18 CST 2003
Hi, perhaps a better description of my problem would help.
>In eVC, you can disable a button by using the TB_SETSTATE message to
>set the state of the button to 0 (disabled) or TBSTATE_ENABLED. You
>can get the HWND (target for the message) from the SHMENUBARINFO
>structure used in SHCreateMenuBar. You will need to provide a bitmap
>for the disabled state. I do all but the latter; for my purposes,
>having a nice icon for the enabled state and a grey box for the
>disabled state is sufficient.
I've tried using a list of images for the disabled button, but nothing
is
shown when the button is made disabled.
I'm adding images to the toolbar using CommandBar_AddBitmap, and then
adding buttons to the commandbar using CommandBar_AddButtons.
The button i'm concerned with is using image of index 0, meaning it is
the
first image added using CommandBar_AddBitmap. How do i set up the
disabled
image list such that the exact same image i added using
CommandBar_AddBitmap will be displayed when the button is disabled?
I used this code:
But nothing shows up when the button is disabled....
HIMAGELIST himlDisabled = ImageList_Create (16,16, ILC_COLOR, 1,10);
HBITMAP hBmp = (HBITMAP) LoadImage(hInst,
MAKEINTRESOURCE(IDB_PLUS_ONE_ICON), IMAGE_BITMAP, 0, 0,
LR_DEFAULTCOLOR);
ImageList_Add(himlDisabled, hBmp, NULL);
SendMessage(hwndButtonBand, TB_SETDISABLEDIMAGELIST, 0,
MAKELONG(himlDisabled, 0));