VC中怎么改变Toolbar上的一个Button的图标
来源:百度知道 编辑:UC知道 时间:2024/07/04 07:37:58
要纯WINDOWS API的,不要MFC的。。。
lResult = SendMessage( // returns LRESULT in lResult
(HWND) hWndControl, // handle to destination control
(UINT) TB_CHANGEBITMAP, // message ID
(WPARAM) wParam, // = (WPARAM) (int) idButton
(LPARAM) lParam // = (LPARAM) MAKELPARAM (iBitmap, 0)
);
请参考:
#include <windows.h>
#include <tchar.h>
#include <commctrl.h>
#pragma comment(lib, "comctl32.lib")
#define ID_BUTTON0 100
LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
static bool change = false;
HIMAGELIST hImgLst;
TBBUTTON tbBtns[] = {
{ 0, ID_BUTTON0 + 0, TBSTATE_ENABLED, BTNS_BUTTON, 0, 0 },
{ 1, ID_BUTTON0 + 1, TBSTATE_ENABLED, BTNS_BUTTON, 0, 0 },
{ 2, ID_BUTTON0 + 2, TBSTATE_ENABLED, BTNS_BUTTON, 0, 0 }, };
switch (uMsg) {
c