I wanna draw the caption, dammit!

This is a discussion on I wanna draw the caption, dammit! within the Windows Programming forums, part of the Platform Specific Boards category; Hello, I'm trying to write my own versions of the WM_NCPAINT, WM_NCHITTEST and other associated nonclient area messages in order ...

  1. #1
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,266

    Unhappy I wanna draw the caption, dammit!

    Hello,

    I'm trying to write my own versions of the WM_NCPAINT, WM_NCHITTEST and other associated nonclient area messages in order to create a custom title bar for my program. The thing is, it seems whenever I send WM_SETTEXT to my window it likes to use the DrawCaption function and undo all my lovely (Yes, really) work.

    Obviously I would like to replace WM_SETTEXT so it can't attempt the unsightly drawing operation, but I don't know how to maintain its functionality (Where is a window's text stored?). Little help?

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    >>Where is a window's text stored?<<

    GetWindowText API fn (just send a WM_GETTEXT msg).

    >>whenever I send WM_SETTEXT to my window it likes to use the DrawCaption function<<

    Then don't send the msg; retrieve the caption and draw it yourself.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  3. #3
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,266
    But I need to update the window's caption on the taskbar as well (It's a media player, so the caption's updated every second to display the current track time), unless there's a way to draw to the taskbar button?!?

  4. #4
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,230
    SetWindowText()

    ...

    But I'm not sure if that will call DrawCaption() or send a WM_SETTEXT message (it seems likely, though.)

    You could always set the window text with SetWindowText() and THEN draw all of your stuff. The simplest solutions are often the best...change the order you do stuff in.

  5. #5
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    >>SetWindowText<<

    From msdn:
    If the target window is owned by the current process, SetWindowText causes a WM_SETTEXT message to be sent to the specified window or control

  6. #6
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,230
    Oh, Mr. Fitlike...sometimes I wonder if you built MSDN yourself...

    like I said, just call SetWindowText() before you do your painting and the point should be moot.

    ...unless, that is, you don't WANT to repaint every time you set the caption...but then I just don't know.

  7. #7
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,266
    Weeeeelllllll, I know I could do that, but then time is wasted in Windows drawing the caption itself and then me going over it. I suppose it'll have to do (But will look icky on slower computers).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Which is the better way to draw?
    By g4j31a5 in forum Game Programming
    Replies: 16
    Last Post: 01-22-2007, 10:56 PM
  2. Button handler
    By Nephiroth in forum Windows Programming
    Replies: 8
    Last Post: 03-12-2006, 05:23 AM
  3. draw function HELP!!!
    By sunoflight77 in forum C++ Programming
    Replies: 1
    Last Post: 05-10-2005, 11:28 PM
  4. ray casting
    By lambs4 in forum Game Programming
    Replies: 62
    Last Post: 01-09-2003, 05:57 PM
  5. Dammit a fat chick has a crush on me!
    By face_master in forum A Brief History of Cprogramming.com
    Replies: 115
    Last Post: 12-25-2002, 10:26 AM

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