-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtoolbar.asm
120 lines (89 loc) · 2.85 KB
/
toolbar.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
; ########################################################################
Do_ToolBar PROTO :DWORD
SetBmpColor PROTO :DWORD
include tbmacros.asm
.data
hTbBmp dd 0
hToolBar dd 0
.code
; ########################################################################
Do_ToolBar proc hWin :DWORD
; ---------------------------------------
; This proc works by using macros so that
; the code is easier to read and modify
; ---------------------------------------
LOCAL bSize :DWORD
LOCAL tbab :TBADDBITMAP
LOCAL tbb :TBBUTTON
; ------------------
; The toolbar bitmap
; ~~~~~~~~~~~~~~~~~~
; You must supply a bitmap for the toolbar that has the
; correct number of the required images, each of the same
; size and in the following strip bitmap form.
; -------------------------------------
; | 1 | 2 | 3 | 4 | 5 | 6 |
; -------------------------------------
; ------------------------
; Uncomment following when
; bitmap has been created
; ------------------------
invoke LoadBitmap,hInstance,2000
mov hTbBmp,eax
; --------------------------------------------------
; Set toolbar button dimensions here, width & height
; --------------------------------------------------
Create_Tool_Bar 24, 24
TBextraData ; additional data for TBBUTTON structure
; -----------------------------------
; Add toolbar buttons and spaces here
; Syntax for the macro TBbutton is
; TBbutton bmpID number, WM_COMMAND ID number
; WM_COMMAND ID numbers start at 50
; -----------------------------------
TBbutton 0, 50
TBbutton 1, 51
TBbutton 2, 52
TBblank
TBbutton 3, 53
TBbutton 4, 54
TBbutton 5, 55
TBblank
TBbutton 6, 56
TBbutton 7, 57
TBblank
TBbutton 8, 58
TBblank
TBbutton 9, 59
TBbutton 10, 60
TBblank
TBbutton 11, 61
ret
Do_ToolBar endp
; ########################################################################
SetBmpColor proc hBitmap:DWORD
LOCAL mDC :DWORD
LOCAL hBrush :DWORD
LOCAL hOldBmp :DWORD
LOCAL hReturn :DWORD
LOCAL hOldBrush :DWORD
invoke CreateCompatibleDC,NULL
mov mDC,eax
invoke SelectObject,mDC,hBitmap
mov hOldBmp,eax
invoke GetSysColor,COLOR_BTNFACE
invoke CreateSolidBrush,eax
mov hBrush,eax
invoke SelectObject,mDC,hBrush
mov hOldBrush,eax
invoke GetPixel,mDC,1,1
invoke ExtFloodFill,mDC,1,1,eax,FLOODFILLSURFACE
invoke SelectObject,mDC,hOldBrush
invoke DeleteObject,hBrush
invoke SelectObject,mDC,hBitmap
mov hReturn,eax
invoke DeleteDC,mDC
mov eax,hReturn
ret
SetBmpColor endp
; #########################################################################