Coder's Guild Mailing List

RE: Minimize box on a toolbar window

Posted by Kory Spansel on 2000-03-31

I tried changing the style using SetWindowLong, but I got undesired results. 
  And then when I went to intercept the WM_NCPAINT message my program would 
just crash here's what I was using:

case WM_NCPAINT:
{
   hdc = GetDCEx(hwnd, (HRGN)wparam, DCX_WINDOW | DCX_INTERSECTRGN);
   GetBoundsRect(hdc, &rect, 0);
   DrawFrameControl(hdc, &rect, DFC_CAPTION, DFCS_CAPTIONMIN);
   ReleaseDC(hwnd, hdc);
   return 0;
}

All this should do is draw a giant minimize button, but it doesn't just even 
do that.  It just crashes then I tried to get rid of the control drawing 
code and then it won't paint correctly.  So I'm basically stuck on this one. 
  And one more question how would I keep the user from resizing my window?  
Without changing my current style?  Thanks again.

Kory Spansel


>Have you looked into SetWindowLong/GetWindowLong and also (believe
>it or not SetClassLong/GetClassLong).  I seem to remember that solving a
>similar issue with SetClassLong one time.
>
>If not, you may be into WM_NCPAINT, e.g....
>
>case WM_NCPAINT:
>{
>     HDC hdc;
>     hdc = GetDCEx(hwnd, (HRGN)wParam, DCX_WINDOW|DCX_INTERSECTRGN);
>     // Paint into this DC
>     ReleaseDC(hwnd, hdc);
>}
>
>
>John Lockwood
>Toll Free:  1 (888) 784-9160
>>Sign up for the FREE newsletter
>Internet Programming Today at:
>http://www.particlewave.com
>
>>To signoff send a mail to listserver@xxxx.xx.xx with
>   "signoff tcg" in the body of your message.

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

Sponsored by Wrox Press - www.wrox.com. Programmer to Programmer (TM)
To signoff send a mail to listserver@xxxx.xx.xx with 
  "signoff tcg" in the body of your message.