How could I split a statusbar into panels? Here's my code:



[...]
.data
szStatusClass db "msctls_statusbar32", 0
[...]
.data?
hStatus dd ?
[...]
.code
[...]
.if uMsg == WM_CREATE
invoke CreateWindowEx,0, addr szStatusClass, 0,
WS_CHILD or WS_VISIBLE,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
hWin, 0, 400000h, 0
mov hStatus, eax
[...]
Posted on 2001-09-28 13:42:23 by bazik
Hehe, found a solution:


[...]
.data
szStatusClass db "msctls_statusbar32", 0
[B] dwStatusParts dw 2[/B]
[...]
.data?
hStatus dd ?
[...]
.code
[...]
.if uMsg == WM_CREATE
invoke CreateWindowEx,0, addr szStatusClass, 0,
WS_CHILD or WS_VISIBLE,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
hWin, 0, 400000h, 0
mov hStatus, eax
[b] mov dword ptr [dwStatusParts], 600[/b]
[b] mov dword ptr [dwStatusParts + 4], -1[/b]

[b] invoke SendMessage, eax, SB_SETPARTS, 2, addr dwStatusParts[/b]
[...]



SB_SETPARTS


SB_SETPARTS
wParam = (WPARAM) nParts;
lParam = (LPARAM) (LPINT) aWidths;

Sets the number of parts in a status window and the coordinate of the right edge of each part.

Returns TRUE if successful, or FALSE otherwise.

nParts
Number of parts to set (cannot be greater than 255).

aWidths
Address of an integer array that has the same number of elements
as parts specified by nParts. Each element in the array specifies
the position, in client coordinates, of the right edge of the
corresponding part. If an element is -1, the position of the right
edge for that part extends to the right edge of the window.

Posted on 2001-09-28 13:55:15 by bazik
Although your concept is okay, you made a mistake:
dwStatusParts dw 2

this creates one word in memory with the value 2. What you probably mean is this:
dwStatusParts dd 2 dup (?)

2 doesn't mean two values are allocated, it is the value you put into it. 2 dup (?) is what you need: 2 duplicates of ? (uninitialized data).
Also note that dw stands for word, NOT for dword. Dword is dd.

There is an easier way to set the values:
.data ;not in .data?
dwStatusParts dd 600, -1

Then you don't need the movs

Thomas
Posted on 2001-09-28 14:01:52 by Thomas