hi,

I was trying to resize the toolbar in the child window,

but it seem doesn't work,

I tried use GetWindowRect under the WM_SIZE msg,,

but return failed

short source below, or have a look at the full source I have attached

please help me!

thankx in adv,


LOCAL r:RECT
LOCAL hChildToolBar1:DWORD

.........

.elseif uMsg==WM_CREATE

invoke CreateWindowEx, 0, addr szToolbarClassName, 0,\
WS_CHILD or WS_VISIBLE or TBSTYLE_TOOLTIPS or CCS_NOPARENTALIGN or\
CCS_NORESIZE or WS_BORDER or TBSTYLE_FLAT,\
0, -1, 1200, 46, hWnd, 0, hInstance, 0
mov hChildToolBar1, eax

.elseif uMsg==WM_SIZE
;invoke MessageBox,hWnd,addr ClosePromptMessage,addr AppName,MB_OK

this function doesn't work
invoke GetWindowRect, hChildToolBar1, addr r
.if eax==1
invoke MessageBox,hWnd,addr ClosePromptMessage,addr AppName,MB_OK
.endif

.........
Posted on 2002-12-05 05:12:00 by Yanda
hChildToolbar1 is local. Once you finished processing WM_CREATE and hit the ret, its value is no longer valid (for subsequent calls to the function).

This is tantemount to forgetting the "static" keyword in C, except there is no static keyword in assembler... Make it a global.

Mirno
Posted on 2002-12-05 05:40:55 by Mirno
:stupid:
thankx Mirno!:alright:
Posted on 2002-12-05 21:56:29 by Yanda
hi,

since the handles are in the child window,

if I create more few child windows,,

how can I manage the handles in each child window locally or globaly???

the only thing comes into my mine is create a array of dynamic mem and save the handles in there,,

but this way cause extra works..

is there other ways???


thankx in adv,,,
Posted on 2002-12-08 21:03:49 by Yanda
most common way is to allocate one large structure for each child window. This struc can hold all data regarding this child window.
Alloc it during WM_CREATE and attach the pointer to the window with SetWindowLong (hwndChild, GWL_USERDATA, lpStruc).

Now you can get it back inside each message with lpStruc = GetWindowLong (hwndChild, GWL_USERDATA).
(Dont forget to free the struc inside WM_DESTROY).

typical child struct:

CHILD_DATA struc
hwndToolbar dd ?
hwndText dd ?
dwWidth dd ?
dwHeight dd ?
....
CHILD_DATA ends
Posted on 2002-12-09 04:24:32 by beaster
thankx beaster,

I will give it a try!
:alright:
Posted on 2002-12-09 13:39:41 by Yanda
hi beaster,

I got another post of the same questions in another thread,

here,

I got stuck,
I follow exact what u show me,
but not work

here is
thankx in adv,thread
Posted on 2002-12-09 14:56:43 by Yanda