且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

工具栏图标Windows API

更新时间:2023-12-06 13:34:16

    你说:
     You said:
 // Initialize button info.
 // IDM_NEW, IDM_OPEN, and IDM_SAVE are application-defined command constants.
 TBBUTTON tbButtons[numButtons] = 
 {
  { MAKELONG(STD_FILENEW, ImageListID), IDM_NEW, TBSTATE_ENABLED, 
   buttonStyles, {0}, 0, (INT_PTR)L"New" },
  { MAKELONG(STD_FILEOPEN, ImageListID), IDM_OPEN, TBSTATE_ENABLED, 
   buttonStyles, {0}, 0, (INT_PTR)L"Open"},
  { MAKELONG(STD_FILESAVE, ImageListID), IDM_SAVE, 0, 
   buttonStyles, {0}, 0, (INT_PTR)L"Save"}
 };





您在TBUTTON数组中发布的以上代码将IDM_NEW更改为您在与要显示的图标相关联的资源文件中声明的id常量.例如,在资源文件中,您加载了一个图标和一个常量 id为ID_NEWDOC,然后将IDM_NEW替换为ID_NEWDOC.应该可以,如果我错了,请纠正我.

The above code that you have posted, in the array of TBUTTON change the IDM_NEW to the id constant that you declared in the resource file that is associated with icon that you want to be shown. For example in the resource file you loaded an icon and the constant id is ID_NEWDOC then replace IDM_NEW with ID_NEWDOC. That should work, correct me if I'm wrong.