The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: vega on December 26, 2007, 03:11:46 PM

Title: How can insert my created bitmap image into a specified tool button ?
Post by: vega on December 26, 2007, 03:11:46 PM
I want to know the method about it.
Teach me, please~
Title: Re: How can insert my created bitmap image into a specified tool button ?
Post by: ToutEnMasm on December 26, 2007, 03:57:07 PM
Hello,
You can put it in an awner-drawn button (big image is possible) or:
   insert a little bitmap (16 by 16 for example) in a button with a bitmap style.
Title: Re: How can insert my created bitmap image into a specified tool button ?
Post by: dsouza123 on December 26, 2007, 04:19:23 PM
In the examples included with MASM32 there are programs with source that use bitmaps for/on buttons
(such as bmbutton.asm) and also ones that deal with toolbars.  And at least one that does both (qikpad.asm).

Examining the included examples with source code is invaluable.
Title: Re: How can insert my created bitmap image into a specified tool button ?
Post by: vega on January 04, 2008, 02:50:07 PM
This is my studing code.
I don't know method that inserts my.Icon or my Bitmap(non System defined, non standard) image into a Button.






               ;
               ;
               
           .IF uMsg == WM_CREATE
              JMP  START_PROCESS
             
               ;
               ;
               



           .Data
              Set_Struct  ToolButton, TBBUTTON
              Set_Struct  ToolAddBitmap, TBADDBITMAP
              Set_Null_Dword  hToolBar
              Set_Constant  ToolBarID, -1
              Set_Constant  BitmapID, NULL
              Set_Constant  BitmapEA, NULL
              Set_Constant  ButtonEA, NULL
             
             
           .Code

           START_PROCESS:
       
              ;; ToolBar reference..........................................
              ;
              Mov  ToolButton.iBitmap, 0
              Mov  ToolButton.idCommand, 0
              Mov  ToolButton.fsState, TBSTATE_ENABLED
              Mov  ToolButton.fsStyle, TBSTYLE_SEP
              Mov  ToolButton.dwData, 0
              Mov  ToolButton.iString, 0
             
              Invoke CreateToolbarEx, hWin, WS_CHILD or WS_VISIBLE or TBSTYLE_TOOLTIPS,
                     ToolBarID, BitmapEA, hInstance, BitmapID, ADDR ToolButton,
                     TRUE, 16, 16, 0, 0, SizeOf TBBUTTON
              Mov  hToolBar, EAX
           
              ;; Adds System defined Bitmap images
              Mov  ToolAddBitmap.hInst, HINST_COMMCTRL
              Mov  ToolAddBitmap.nID, 2                ;;Button Size: 1=big,  2=small
              Invoke SendMessage,  hToolBar, TB_ADDBITMAP, TRUE, ADDR ToolAddBitmap
   
              Mov  ToolButton.iBitmap,   STD_FILENEW
              Mov  ToolButton.idCommand, NEW_FILE
              Mov  ToolButton.fsStyle,   TBSTYLE_BUTTON
              Invoke SendMessage,  hToolBar, TB_ADDBUTTONS, TRUE, ADDR ToolButton
           
              Mov  ToolButton.iBitmap,   STD_FILEOPEN
              Mov  ToolButton.idCommand, OPEN_FILE
              Mov  ToolButton.fsStyle,   TBSTYLE_BUTTON
              Invoke SendMessage,  hToolBar, TB_ADDBUTTONS, TRUE, ADDR ToolButton
           
              Mov  ToolButton.iBitmap,   STD_FILESAVE
              Mov  ToolButton.idCommand, SAVE_FILE
              Mov  ToolButton.fsStyle,   TBSTYLE_BUTTON
              Invoke SendMessage,  hToolBar, TB_ADDBUTTONS, TRUE, ADDR ToolButton
   
              Mov  ToolButton.iBitmap,   0         
              Mov  ToolButton.idCommand, 0
              Mov  ToolButton.fsStyle,   TBSTYLE_SEP
              Invoke SendMessage,  hToolBar, TB_ADDBUTTONS, TRUE, ADDR ToolButton
           
              Mov  ToolButton.iBitmap,   STD_PRINT 
              Mov  ToolButton.idCommand, PRINT_FILE
              Mov  ToolButton.fsStyle,   TBSTYLE_BUTTON
              Invoke SendMessage,  hToolBar, TB_ADDBUTTONS, TRUE, ADDR ToolButton
           
              Mov  ToolButton.iBitmap,   STD_PROPERTIES
              Mov  ToolButton.idCommand, PAGE_CONFIG
              Mov  ToolButton.fsStyle,   TBSTYLE_BUTTON
              Invoke SendMessage,  hToolBar, TB_ADDBUTTONS, TRUE, ADDR ToolButton
   
              Mov  ToolButton.iBitmap,   0   
              Mov  ToolButton.idCommand, 0
              Mov  ToolButton.fsStyle,   TBSTYLE_SEP
              Invoke SendMessage,  hToolBar, TB_ADDBUTTONS, TRUE, ADDR ToolButton
           
              Mov  ToolButton.iBitmap,   STD_CUT
              Mov  ToolButton.idCommand, CUT_MENU
              Mov  ToolButton.fsStyle,   TBSTYLE_BUTTON
              Invoke SendMessage,  hToolBar, TB_ADDBUTTONS, TRUE, ADDR ToolButton
           
              Mov  ToolButton.iBitmap,   STD_COPY 
              Mov  ToolButton.idCommand, COPY_MENU
              Mov  ToolButton.fsStyle,   TBSTYLE_BUTTON
              Invoke SendMessage,  hToolBar, TB_ADDBUTTONS, TRUE, ADDR ToolButton
   
              Mov  ToolButton.iBitmap,   STD_PASTE   
              Mov  ToolButton.idCommand, PASTE_MENU
              Mov  ToolButton.fsStyle,   TBSTYLE_BUTTON
              Invoke SendMessage,  hToolBar, TB_ADDBUTTONS, TRUE, ADDR ToolButton
           
              Mov  ToolButton.iBitmap,   STD_DELETE 
              Mov  ToolButton.idCommand, DELETE_MENU
              Mov  ToolButton.fsStyle,   TBSTYLE_BUTTON
              Invoke SendMessage,  hToolBar, TB_ADDBUTTONS, TRUE, ADDR ToolButton
           
              Mov  ToolButton.iBitmap,   0     
              Mov  ToolButton.idCommand, 0
              Mov  ToolButton.fsStyle,   TBSTYLE_SEP
              Invoke SendMessage,  hToolBar, TB_ADDBUTTONS, TRUE, ADDR ToolButton
   
              Mov  ToolButton.iBitmap,   STD_UNDO   
              Mov  ToolButton.idCommand, UNDO_MENU
              Mov  ToolButton.fsStyle,   TBSTYLE_BUTTON
              Invoke SendMessage,  hToolBar, TB_ADDBUTTONS, TRUE, ADDR ToolButton
           
              Mov  ToolButton.iBitmap,   0         
              Mov  ToolButton.idCommand, 0
              Mov  ToolButton.fsStyle,   TBSTYLE_SEP
              Invoke SendMessage,  hToolBar, TB_ADDBUTTONS, TRUE, ADDR ToolButton
           
              Mov  ToolButton.iBitmap,   STD_FIND   
              Mov  ToolButton.idCommand, FIND_MENU
              Mov  ToolButton.fsStyle,   TBSTYLE_BUTTON
              Invoke SendMessage,  hToolBar, TB_ADDBUTTONS, TRUE, ADDR ToolButton
           
              Mov  ToolButton.iBitmap,   STD_REPLACE 
              Mov  ToolButton.idCommand, REPLACE_MENU
              Mov  ToolButton.fsStyle,   TBSTYLE_BUTTON
              Send_Message_to  hToolBar, TB_ADDBUTTONS, TRUE, ADDR ToolButton


                             ;
                             ;







Title: Re: How can insert my created bitmap image into a specified tool button ?
Post by: vega on January 08, 2008, 02:02:38 AM
In my study code,
I used System defined standard Tool buttons that supported by Comctl32.Lib file.
I want to add two tool button, as like as Forward  & Reward - Block Indent tool button on the Quick.Editor.

              ;; Adds System defined Bitmap images
              Mov  ToolAddBitmap.hInst, HINST_COMMCTRL
              Mov  ToolAddBitmap.nID, 2                ;;Button Size: 1=big,  2=small
              Invoke SendMessage,  hToolBar, TB_ADDBITMAP, TRUE, ADDR ToolAddBitmap

How can add a non standard Tool button in this mode?