i have a toolbar on a window for testing purposes. i have a problem though with the space right below bottom border of the toolbar and the buttons. how do i limit the space between the botton and the bottom border. i know this can be done somehow because the asmedit made by vkim does it properly. anyhow here is the source code:
.586

.model flat, stdcall
option casemap :none

include /masm32/include/windows.inc
include /masm32/include/kernel32.inc
include /masm32/include/user32.inc
include /masm32/include/comctl32.inc

includelib /masm32/lib/kernel32.lib
includelib /masm32/lib/user32.lib
includelib /masm32/lib/comctl32.lib

WinMain PROTO :DWORD,:DWORD,:DWORD,:DWORD
TopXY PROTO :DWORD,:DWORD

ID_TB_NEW equ 3001
ID_TB_OPEN equ 3002
ID_TB_SAVE equ 3003
ID_TB_PRINT equ 3004
ID_TB_CUT equ 3005
ID_TB_COPY equ 3006
ID_TB_PASTE equ 3007
ID_TB_FIND equ 3008
ID_TB_FINDNEXT equ 3009
ID_TB_FINDPREVIOUS equ 3010
ID_TB_REPLACE equ 3011
ID_TB_GOTO equ 3012

.data
ClassName db "SimpleWinClass",0
CaptionText db "Template",0

tb TBBUTTON <0, ID_TB_NEW,TBSTATE_ENABLED,0,0,0,0>
TBBUTTON <1, ID_TB_OPEN, TBSTATE_ENABLED,0,0,0.0>
TBBUTTON <2, ID_TB_SAVE, TBSTATE_ENABLED,0,0,0.0>
TBBUTTON <3, ID_TB_PRINT, TBSTATE_ENABLED,0,0,0.0>
TBBUTTON <4, ID_TB_CUT, TBSTATE_ENABLED,0,0,0.0>
TBBUTTON <5, ID_TB_COPY, TBSTATE_ENABLED,0,0,0.0>
TBBUTTON <6, ID_TB_PASTE, TBSTATE_ENABLED,0,0,0.0>
TBBUTTON <7, ID_TB_FIND, TBSTATE_ENABLED,0,0,0.0>
TBBUTTON <8, ID_TB_FINDNEXT, TBSTATE_ENABLED,0,0,0.0>
TBBUTTON <9, ID_TB_FINDPREVIOUS, TBSTATE_ENABLED,0,0,0.0>
TBBUTTON <10,ID_TB_REPLACE, TBSTATE_ENABLED,0,0,0.0>
TBBUTTON <11,ID_TB_GOTO, TBSTATE_ENABLED,0,0,0.0>

.data?
hWnd HANDLE ?
hInstance HANDLE ?

.code
start:
invoke GetModuleHandle, NULL
mov hInstance, eax
invoke WinMain,hInstance,NULL,NULL,SW_SHOWDEFAULT
invoke ExitProcess,eax

; ########################################################################

WinMain proc hInst:DWORD, hPrevIns:DWORD, CmdLine:DWORD, CmdShow:DWORD

LOCAL wc :WNDCLASSEX
LOCAL msg :MSG
LOCAL Wwd :DWORD
LOCAL Wht :DWORD
LOCAL Wtx :DWORD
LOCAL Wty :DWORD

mov wc.cbSize, SIZEOF WNDCLASSEX
mov wc.style, CS_HREDRAW + CS_VREDRAW
mov wc.lpfnWndProc, OFFSET WndProc
mov wc.cbClsExtra, NULL
mov wc.cbWndExtra, NULL
mov eax, hInstance
mov wc.hInstance, eax
invoke LoadIcon, NULL,IDI_APPLICATION
mov wc.hIcon, eax
mov wc.hIconSm, eax
invoke LoadCursor, NULL,IDC_ARROW
mov wc.hCursor, eax
mov wc.hbrBackground,COLOR_APPWORKSPACE
mov wc.lpszMenuName, NULL
mov wc.lpszClassName,OFFSET ClassName
invoke RegisterClassEx, addr wc

mov Wwd, 500
mov Wht, 350

invoke GetSystemMetrics,SM_CXSCREEN
invoke TopXY,Wwd,eax
mov Wtx, eax

invoke GetSystemMetrics,SM_CYSCREEN
invoke TopXY,Wht,eax
mov Wty, eax

invoke CreateWindowEx, NULL,
ADDR ClassName,
ADDR CaptionText,
WS_OVERLAPPEDWINDOW,
Wtx,Wty,Wwd,Wht,
NULL,
NULL,
hInst,
NULL
mov hWnd,eax
invoke ShowWindow,hWnd,SW_SHOWNORMAL
invoke UpdateWindow,hWnd

StartLoop:
invoke GetMessage,ADDR msg,NULL,0,0
cmp eax, 0
je ExitLoop
invoke TranslateMessage, ADDR msg
invoke DispatchMessage, ADDR msg
jmp StartLoop
ExitLoop:

mov eax,msg.wParam
ret

WinMain endp

; ########################################################################

WndProc proc hWin:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM

.IF uMsg == WM_CREATE
invoke InitCommonControls
invoke CreateToolbarEx, hWin,
WS_CHILD + WS_VISIBLE + TBSTYLE_FLAT + WS_BORDER,
0,
12,
HINST_COMMCTRL,
IDB_STD_SMALL_COLOR,
addr tb,
12,
16,16,16,16,
sizeof tb

.ELSEIF uMsg == WM_DESTROY
invoke PostQuitMessage,NULL


.ELSE
invoke DefWindowProc,hWin,uMsg,wParam,lParam
ret

.ENDIF
xor eax,eax
ret

WndProc endp


; ########################################################################

TopXY proc wDim:DWORD, sDim:DWORD

shr sDim, 1
shr wDim, 1
mov eax, wDim
sub sDim, eax
mov eax,sDim
ret

TopXY endp

; #########################################################################

end start
Posted on 2002-05-05 12:07:43 by smurf