Hi, everyone,
I'v create a toolbar with several buttons contained in a rebar band in WM_CREATE message,well the toolbar display well when max-min the main-window,but while I click any place in the client area,the toolbar buttons disappeared and only the rebar frame left:
the WM_CREATE :
the WM_SIZE message
Do I lost something to repair the rebar?
Thanks in avdvance!
Bst regards!
I'v create a toolbar with several buttons contained in a rebar band in WM_CREATE message,well the toolbar display well when max-min the main-window,but while I click any place in the client area,the toolbar buttons disappeared and only the rebar frame left:
BuildRebar proc hParent:dword
LOCAL hwndRebar:HWND
LOCAL WhWnd :HWND
LOCAL lResult :DWORD
;-------------------------
;1.Create the rebar window
;-------------------------
push hParent
pop WhWnd
Invoke CreateWindowEx, WS_EX_TOOLWINDOW, addr ReBarClassName, NULL,\
WS_CHILD Or WS_CLIPCHILDREN Or WS_CLIPSIBLINGS Or WS_VISIBLE or WS_BORDER Or RBS_VARHEIGHT Or RBS_BANDBORDERS OR CCS_NODIVIDER OR CCS_NOPARENTALIGN ,\
0, 0, rcClient.right, 10, WhWnd, NULL, ghInst, NULL
mov hwndRebar,eax
.if hwndRebar==NULL
invoke MessageBox,NULL,CTEXT("Create Rebar Window Error."),addr szFatalError,MB_ICONASTERISK
jmp @F
.endif
;---------------------------
;2.Create the toolbar window
;--------------------------
invoke CreateToolbarEx,hwndRebar,\
WS_CHILD or WS_VISIBLE or WS_BORDER or TBSTYLE_TOOLTIPS OR\
CCS_NOPARENTALIGN,\
IDR_TOOLBAR, MAXBUTTONS, HINST_COMMCTRL, IDB_STD_SMALL_COLOR, \
ADDR TBButtons,NUMBUTTONS , cxSmIcon, cySmIcon, cxSmIcon, cySmIcon, sizeof TBBUTTON
mov hTBWnd,eax
;----------------------------------------------------------------------
;2.Initialize and send the REBARINFO structure(shared by all bands)
;---------------------------------------------------------------------
mov rbi.cbSize,sizeof REBARINFO ;size of REBARINFO
mov rbi.fMask, 0 ;must be
m2m rbi.himl,0 ;Handle to an image lis
invoke SendMessage,hwndRebar,RB_SETBARINFO,0,ADDR rbi ;insert
;.if eax==NULL
; invoke MessageBox,hParent,CTEXT("Initial Rebar Info Error."),\
; szFatalError,MB_ICONERROR
; jmp @F
;.endif
;------------------------------------------------------------------------
;3.Initialize structure members that all bands will share.
;------------------------------------------------------------------------
mov rbbi.cbSize, SIZEOF REBARBANDINFO ;size
mov rbbi.fMask, RBBIM_COLORS or RBBIM_CHILD or RBBIM_CHILDSIZE or \
RBBIM_STYLE or RBBIM_ID
invoke GetSysColor,COLOR_BTNTEXT
mov rbbi.clrFore,eax
invoke GetSysColor,COLOR_BTNFACE
mov rbbi.clrBack,eax
;fStyle should include RBBS_GRIPPERALWAYS
;otherwise gripper may or may not be displayed
mov rbbi.fStyle,RBBS_NOVERT or \ ;do not display in vertical orientation
RBBS_CHILDEDGE or \ ;display the top and bottom edge of child window
RBBS_GRIPPERALWAYS ;always display gripper
push hTBWnd
pop rbbi.hwndChild
push IDR_TOOLBAR
pop rbbi.wID
mov eax,rcClient.right
shr eax,1
mov rbbi.cxMinChild,eax ;the band's mini width is 1/2 of client window
mov eax,cySmIcon
shr eax,1
add eax,cySmIcon
mov rbbi.cyMinChild,eax ;the band's mini height is 3/2 cySmIcon
invoke SendMessage,hwndRebar,RB_INSERTBAND,-1,addr rbbi
Invoke ShowWindow,hwndRebar,SW_SHOWNORMAL
@@:
mov eax, hwndRebar
ret
BuildRebar endp
the WM_CREATE :
WM_CREATE:
;...
;-----------------------------------------------
;creat Rebar window
;----------------------------------------------
invoke BuildRebar,hWin
push eax
pop hRebar
;...
the WM_SIZE message
.elseif uMsg== WM_SIZE
; invoke SendMessage,hToolBar,TB_AUTOSIZE,0,0
;Get the client area window width and height
;invoke SendMessage,hToolBar,TB_AUTOSIZE,0,0
m2m caW, lParam[0] ; client area width
m2m caH, lParam[2] ; client area height
invoke GetWindowRect,hRebar,ADDR rcRebar
mov eax,rcRebar.bottom
sub eax,rcRebar.top
invoke MoveWindow,hRebar,0,0,caW,eax,TRUE
;re-size status bar window
invoke GetWindowRect,hStatus,ADDR rcStatus
mov eax, rcStatus.bottom
sub eax, rcStatus.top
sub caH, eax
invoke MoveWindow,hStatus,0,caH,caW,caH,TRUE
Do I lost something to repair the rebar?
Thanks in avdvance!
Bst regards!
hi, luckrock, see the following tutorial and it's source codes.
Perhaps you will get something from it. :D http://211.90.241.130:22366/view.asp?file=20
BTW: there's some codes in the package of MASM32 .
the tutorials in RadAsm IS ALSO PERFECT. http://www.radasm.com/projects/Demo.zip
Perhaps you will get something from it. :D http://211.90.241.130:22366/view.asp?file=20
BTW: there's some codes in the package of MASM32 .
the tutorials in RadAsm IS ALSO PERFECT. http://www.radasm.com/projects/Demo.zip
Hi,Miaomiao
Thanks.althought both are worth studying. Well,the first tut is not related to rebar control.and the second is based on a dialog.
not suit to my win32 sdi app case.
Anyway,thanks a lot
BST RGS.
Thanks.althought both are worth studying. Well,the first tut is not related to rebar control.and the second is based on a dialog.
not suit to my win32 sdi app case.
Anyway,thanks a lot
BST RGS.