   draw custom menu or dropdown list?
  Hi,Win32 API: What is the best way to draw something outside the client rect of a window, i.e. to draw menus and dropdown-lists? It tried GetDC(NULL), but the problem is to restore the stuff that was under that area.bye,Chris   
  What you might want is the window rectangle, not the client rectangle.Some things that might help.GetWindowDC & WM_NCPAINT   ;  Top-level windows (i.e. the actual things with borders and captions that you can move around the screen) are not able to draw outside of their client areas, because the OS forces them to have the WS_CLIPSIBLINGS style. If you need to draw outside the client area of a top-level window, you need to actually create a secondary top-level window, which is how menus, drop-downs, tooltips, etc. usually are implemented.   ;  If you mean you want to draw something that will draw over the extents of your entire window, then the best (maybe only) way would be to create another window, and draw onto that. That's what most windows controls and popup menus do, from what I can see.   ;  Yeah, I already tried it with another top-level window, but the problem is that the parent window (i.e. the window where the custom drop-down control is in) looses the focus and the title bar gets gray. Do you know how to avoid that?   ;  What you want is an owned window. Just pass the owner window (your main window) as the hWndParent parameter of CreateWindow/CreateWindowEx, and make sure that WS_CHILD is not set.   ;  Hi,I tried what you described as "owned window". No luck. The main window still looses the focus and gets gray. I really want to know how that menu and dropdown stuff is implemented!   ;  one fairly easy way to do it is to have your popup window subclass or hook its parent window and then respond to the WM_NCACTIVATE msg with FALSE, which will leave the parent's window's titlebar, etc., in the active state.but there's any even easier way to do this as I've done it before for my own popup menu class. i just have to find the code as it was written years ago and I can't remember exactly what was done.   ;  by parent, i really meant owned, of course :)   ;  i found the following code which might do the trick:// handle if in AOT mode - make sure we're not activated and that we stay on topcase WM_WINDOWPOSCHANGING:    if( rtProps.alwaysOnTop )    {   ((LPWINDOWPOS)lParam)->flags |=   SWP_NOACTIVATE;   ((LPWINDOWPOS)lParam)->flags &= ~(SWP_NOOWNERZORDER | SWP_NOZORDER);   ((LPWINDOWPOS)lParam)->hwndInsertAfter = HWND_TOPMOST;    }    return 0; // no default processing so no WM_GETMINMAXINFO msg is senti'm not sure if such an app gets keyboard focus though as this code came from an alt+tab replacement and it's using a low-level keyboard hook