-
-
[求助]在masm32编写的工具栏中加上自己定义的按钮图标
-
发表于: 2014-6-4 15:06 2770
-
自已画的BMP图形文件加在按钮上,按钮上一直无法显示图标。
include windows.inc
include user32.inc
include kernel32.inc
include shell32.inc
include comctl32.inc
include comdlg32.inc
include gdi32.inc
includelib user32.lib
includelib kernel32.lib
includelib shell32.lib
includelib comctl32.lib
includelib comdlg32.lib
includelib gdi32.lib
.const
TOOLBARICON equ 4001
IDC_TBR1 equ 1003
staddtool equ this byte
TBBUTTON <TOOLBARICON,IDM_FAVORIT,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0,-1>
NUM_BUTTONSS EQU 1
...............................部份代码.........................................
WndProc proc hWin:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
LOCAL @tbadd:TBADDBITMAP
mov eax,uMsg
.if eax==WM_INITDIALOG
push hWin
pop hWnd
invoke GetDlgItem,hWnd,IDC_TBR1
mov Htoolbar,eax
;填充TBADDBITMAP结构
push hInstance
pop @tbadd.hInst
MOV @tbadd.nID,TOOLBARICON ;放入位图ID
INVOKE SendMessage,Htoolbar,TB_ADDBITMAP,1,addr @tbadd
invoke SendMessage,Htoolbar,TB_SETBITMAPSIZE,0,00100010h ;位图大小
invoke SendMessage,Htoolbar,TB_SETBUTTONSIZE,0,00200020h ;按钮大小 invoke SendMessage,Htoolbar,TB_BUTTONSTRUCTSIZE,SIZEOF TBBUTTON,0
invoke SendMessage,Htoolbar,TB_ADDBUTTONS,1,OFFSET staddtool
不知道TBADDBITMAP结构结构中哪里错了,还是其它地方错了,按钮上老是不显示图像
include windows.inc
include user32.inc
include kernel32.inc
include shell32.inc
include comctl32.inc
include comdlg32.inc
include gdi32.inc
includelib user32.lib
includelib kernel32.lib
includelib shell32.lib
includelib comctl32.lib
includelib comdlg32.lib
includelib gdi32.lib
.const
TOOLBARICON equ 4001
IDC_TBR1 equ 1003
staddtool equ this byte
TBBUTTON <TOOLBARICON,IDM_FAVORIT,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0,-1>
NUM_BUTTONSS EQU 1
...............................部份代码.........................................
WndProc proc hWin:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
LOCAL @tbadd:TBADDBITMAP
mov eax,uMsg
.if eax==WM_INITDIALOG
push hWin
pop hWnd
invoke GetDlgItem,hWnd,IDC_TBR1
mov Htoolbar,eax
;填充TBADDBITMAP结构
push hInstance
pop @tbadd.hInst
MOV @tbadd.nID,TOOLBARICON ;放入位图ID
INVOKE SendMessage,Htoolbar,TB_ADDBITMAP,1,addr @tbadd
invoke SendMessage,Htoolbar,TB_SETBITMAPSIZE,0,00100010h ;位图大小
invoke SendMessage,Htoolbar,TB_SETBUTTONSIZE,0,00200020h ;按钮大小 invoke SendMessage,Htoolbar,TB_BUTTONSTRUCTSIZE,SIZEOF TBBUTTON,0
invoke SendMessage,Htoolbar,TB_ADDBUTTONS,1,OFFSET staddtool
不知道TBADDBITMAP结构结构中哪里错了,还是其它地方错了,按钮上老是不显示图像
[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!
赞赏
他的文章
看原图
赞赏
雪币:
留言: