Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Need help on subclassing windows

Need help on subclassing windows

Scheduled Pinned Locked Moved C / C++ / MFC
helpcsharpgraphicsc++
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cnurse
    wrote on last edited by
    #1

    Hi guys, I've developed in C++ for many years, but more recently have been working in C# and VB.NET. I am developing my own version of themed controls where the user can govern just about any aspect of control drawing, like shape and colour etc. I want to extend this control now to Windows Captions (i.e. Form captions). One thing that I have never fully gained is an understanding of what windows messages to trap, whether to let the default processing always take place, and what values to return. Even when I think I am following the MSDN SDK documention on WM_... notifications I still can't seem to get it right. My problem seems to mainly be in getting setup, i.e. calling GetWindowDC to give me the entire drawing area of the window. Once I have called GetWindowDC I can construct a .NET Graphics object, and later dispose of both after my drawing is complete. I do this and clear the Graphics object to red, so I should see all the non-client area turn red, which happens when the window is first drawn, but after that, as I start to move the window or size it I dont see the DC get consistently filled with red. In summary then, if I could get a control of non-client drawing then I would have raised my programming standard significantly. I would really be immensley greatful if you guys could point me at a definitive guide to subclassing or window's message processing, without recommending 3rd part controls as I am a DIY fanatic! 8-) Also, if any of you can spare some time now and again, perhaps on MSN messenger to chat about this issue that would just be solid gold. I await your responses with baited breath! Thanks all! Nursey

    H 1 Reply Last reply
    0
    • C cnurse

      Hi guys, I've developed in C++ for many years, but more recently have been working in C# and VB.NET. I am developing my own version of themed controls where the user can govern just about any aspect of control drawing, like shape and colour etc. I want to extend this control now to Windows Captions (i.e. Form captions). One thing that I have never fully gained is an understanding of what windows messages to trap, whether to let the default processing always take place, and what values to return. Even when I think I am following the MSDN SDK documention on WM_... notifications I still can't seem to get it right. My problem seems to mainly be in getting setup, i.e. calling GetWindowDC to give me the entire drawing area of the window. Once I have called GetWindowDC I can construct a .NET Graphics object, and later dispose of both after my drawing is complete. I do this and clear the Graphics object to red, so I should see all the non-client area turn red, which happens when the window is first drawn, but after that, as I start to move the window or size it I dont see the DC get consistently filled with red. In summary then, if I could get a control of non-client drawing then I would have raised my programming standard significantly. I would really be immensley greatful if you guys could point me at a definitive guide to subclassing or window's message processing, without recommending 3rd part controls as I am a DIY fanatic! 8-) Also, if any of you can spare some time now and again, perhaps on MSN messenger to chat about this issue that would just be solid gold. I await your responses with baited breath! Thanks all! Nursey

      H Offline
      H Offline
      Hesham Amin
      wrote on last edited by
      #2

      Override the OnMessage method which recieves a Message structure.

      C 1 Reply Last reply
      0
      • H Hesham Amin

        Override the OnMessage method which recieves a Message structure.

        C Offline
        C Offline
        cnurse
        wrote on last edited by
        #3

        Thanks but I know how to get to the messages. As I said the problem has always been what messages to process. To be specific, what messages do I have to trap and process if I want to take entire responsibility for NC processing/drawing? Do I always have to perform the default processing then do my thing? See? Thanks. Nursey

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups