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. Inconsistentcies Between Win32 and MFC

Inconsistentcies Between Win32 and MFC

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
9 Posts 3 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.
  • F Offline
    F Offline
    ForNow
    wrote on last edited by
    #1

    Hi The Win32 OWNERDRAWITEM is handled by WS_DRAWITEM in the form of wParam lParam message While framework virtual function CStatic::DrawItem takes a LPDRAWITEMSTRUCT for a parameter Am I missing something ?

    J 1 Reply Last reply
    0
    • F ForNow

      Hi The Win32 OWNERDRAWITEM is handled by WS_DRAWITEM in the form of wParam lParam message While framework virtual function CStatic::DrawItem takes a LPDRAWITEMSTRUCT for a parameter Am I missing something ?

      J Offline
      J Offline
      jeron1
      wrote on last edited by
      #2

      That seems right, that kind of thing is common in MFC. In this case the lParam would need to be cast to a LPDRAWITEMSTRUCT. In MFC you don't need the cast, it's actually pretty similar.

      "the debugger doesn't tell me anything because this code compiles just fine" - random QA comment "Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst "I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle

      F 1 Reply Last reply
      0
      • J jeron1

        That seems right, that kind of thing is common in MFC. In this case the lParam would need to be cast to a LPDRAWITEMSTRUCT. In MFC you don't need the cast, it's actually pretty similar.

        "the debugger doesn't tell me anything because this code compiles just fine" - random QA comment "Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst "I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle

        F Offline
        F Offline
        ForNow
        wrote on last edited by
        #3

        Doi need a message map entry to get my CStatic::DrawItem to be called I have SS_OWNERDRAW but it is not being called

        J L 2 Replies Last reply
        0
        • F ForNow

          Doi need a message map entry to get my CStatic::DrawItem to be called I have SS_OWNERDRAW but it is not being called

          J Offline
          J Offline
          jeron1
          wrote on last edited by
          #4

          Are WS_VISIBLE and WS_CHILD styles set?

          "the debugger doesn't tell me anything because this code compiles just fine" - random QA comment "Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst "I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle

          F 1 Reply Last reply
          0
          • J jeron1

            Are WS_VISIBLE and WS_CHILD styles set?

            "the debugger doesn't tell me anything because this code compiles just fine" - random QA comment "Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst "I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle

            F Offline
            F Offline
            ForNow
            wrote on last edited by
            #5

            Just came back home yes both are set do I need to subclass the Static control

            J 1 Reply Last reply
            0
            • F ForNow

              Just came back home yes both are set do I need to subclass the Static control

              J Offline
              J Offline
              jeron1
              wrote on last edited by
              #6

              Yes, I believe so.

              "the debugger doesn't tell me anything because this code compiles just fine" - random QA comment "Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst "I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle

              F 1 Reply Last reply
              0
              • J jeron1

                Yes, I believe so.

                "the debugger doesn't tell me anything because this code compiles just fine" - random QA comment "Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst "I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle

                F Offline
                F Offline
                ForNow
                wrote on last edited by
                #7

                Have to Use Create DDX_Control wont do it As aside what is the best tool to draw a nice bitmap of Text

                1 Reply Last reply
                0
                • F ForNow

                  Doi need a message map entry to get my CStatic::DrawItem to be called I have SS_OWNERDRAW but it is not being called

                  L Offline
                  L Offline
                  leon de boer
                  wrote on last edited by
                  #8

                  How did you set SS_OWNERDRAW if you did it by PreSubclassWindow in MFC there is a big gotcha with Static Text.

                  ModifyStyle(0, SS_OWNERDRAW); // WRONG for Static text ... won't work
                  ModifyStyle(SS_TYPEMASK, SS_OWNERDRAW); // Correct

                  If you look at the bit field assignments you will see why you have to mask because unlike buttons with SS_OWNERDRAW there is overlap in bits between SS_RIGHT of static text and SS_OWNERDRAW.

                  In vino veritas

                  F 1 Reply Last reply
                  0
                  • L leon de boer

                    How did you set SS_OWNERDRAW if you did it by PreSubclassWindow in MFC there is a big gotcha with Static Text.

                    ModifyStyle(0, SS_OWNERDRAW); // WRONG for Static text ... won't work
                    ModifyStyle(SS_TYPEMASK, SS_OWNERDRAW); // Correct

                    If you look at the bit field assignments you will see why you have to mask because unlike buttons with SS_OWNERDRAW there is overlap in bits between SS_RIGHT of static text and SS_OWNERDRAW.

                    In vino veritas

                    F Offline
                    F Offline
                    ForNow
                    wrote on last edited by
                    #9

                    I set it in my resource file just SS_OWNERDRAW WS_CHILD WS_VISIBLE I tried many methods including SETBITMAP to display the bitmap nothing worked until I used Create and Drawitem

                    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