Wm_ncpaint

This is a discussion on Wm_ncpaint within the Windows Programming forums, part of the Platform Specific Boards category; Just for fun, I handled the WM_NCPAINT message for a window and just returned 0. I was surprised however to ...

  1. #1
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401

    Wm_ncpaint

    Just for fun, I handled the WM_NCPAINT message for a window and just returned 0. I was surprised however to find that clicking another window, then returning to my window, resulted in the entire frame being drawn on. Is there another message that can redraw the frame? Also, if I drag the window around rapidly by dragging on the caption bar, the frame becomes garbled and distorted. Any ideas?
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  2. #2
    Registered User
    Join Date
    Feb 2003
    Posts
    76
    I would assume that the WM_NCACTIVATE message is also being sent.

  3. #3
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    If I now wanted to paint my own frame, what would I do? I've had a look at the GetRegionData() function and all that, but I'm a bit stumped on how to set up my buffer so it's big enough. Would I have to specify a small buffer, get the return value, then specify the adequate buffer? And then, how would I know which rectangle specified which part of the frame? It's all so complicated.
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  4. #4
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,259
    There are limitations to making your own frames. If you try to access the window menu (In the top left corner of the window), for example, Microsoft decided that would be a good time to redraw the titlebar icons internally, so it'll draw over anything you've done.

    When I did it, I didn't actually change the size or shape of the frame from the default, but it could be drawn to by GetWindowDC(hwnd). Not sure if you're trying to be spiffy, though.

  5. #5
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    I'm really lost here. The GetRegionData() function seems infintely difficult to use. I don't understand how to set the array size properly, and plus, when I did the following, it return 0:

    Code:
    bSize=GetRegionData(hrgn,0,NULL);
    The Win32 Programmer's Reference claims that my code should return the required array size, but it only returned 0. Why wont it work?
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21