Hello everybody,
ok... the WM_NCCALCSIZE is driving me nuts. For the past couple of weeks on and off I've been trying to do some custom things with Menus and Toolbars. Specifically, I'd like to put a custom toolbar in the non-client area so it doesn't intefere with the client area. I have several reasons for wanting to do this, and although I have a working program with the toolbar as a child *in* the client area, it still bugs me

So...I revisited WM_NCCALCSIZE that I had given up on before and I basically find the same problems. Namely, if I process WM_NCCALCSIZE the client area becomes the correct size, but my title bar is not drawn nor is the menu. However, the frame is. As far as I know, this should all be handled by WM_NCPAINT (which I'm not touching). Does anyone know what I'm doing wrong???

Here's the relevant code:



@@NCCalcSize: cmp wParam,TRUE
je @F
mov eax,lParam
add [eax].RECT.top,30
add [eax].RECT.left,4
sub [eax].RECT.right,4
sub [eax].RECT.bottom,4
xor eax,eax
ret
@@: mov eax,lParam
add [eax].RECT.top,30
add [eax].RECT.left,4
sub [eax].RECT.right,4
sub [eax].RECT.bottom,4
mov eax,WVR_HREDRAW or WVR_VREDRAW
ret


Thanks in advance. I know I've asked questions related to this before and I've tried working it out, but I'm still not getting anywhere :(

--Chorus

PS I know it looks like repeated code, but I'm not too concerned at this point. I'm just trying to get it working!
Posted on 2002-05-18 00:20:22 by chorus
Ok. I figured this problem out: I cheated. The code that works is:



@@NCCalcSize: invoke DefWindowProc,hWin,uMsg,wParam,lParam
mov ebx,lParam
add [ebx].RECT.top,30
ret


As you can see, I just call DefWindowProc, fix up the rectangle like I want and leave the return value as is. Everything comes out just fine.

Now that I have this space, I can pop in a toolbar into the non-client area. Which leads me to a new question: What's the best way to do this. My current implementation is to create the toolbar (it's my own class by the way) as an owned window (not a child window) and just move it around with the parent window so it *looks* like it's in the non-client area.

It works for me :) But if there's an alternative that's more "natural" I'd be interested in hearing it.

Thanks

--Chorus
Posted on 2002-05-18 09:04:19 by chorus