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. CEdit::SetHighlight

CEdit::SetHighlight

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
10 Posts 4 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.
  • A Offline
    A Offline
    AlecJames
    wrote on last edited by
    #1

    I haven't used SetHighlight before. I tried and got unresolved external (it compiles OK but does not link). I'm using VS2013, MFC in a static library, 32 bit, platform toolset VS2013 v120. Any ideas?

    L J 2 Replies Last reply
    0
    • A AlecJames

      I haven't used SetHighlight before. I tried and got unresolved external (it compiles OK but does not link). I'm using VS2013, MFC in a static library, 32 bit, platform toolset VS2013 v120. Any ideas?

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      What does the error message say?

      A 1 Reply Last reply
      0
      • A AlecJames

        I haven't used SetHighlight before. I tried and got unresolved external (it compiles OK but does not link). I'm using VS2013, MFC in a static library, 32 bit, platform toolset VS2013 v120. Any ideas?

        J Offline
        J Offline
        Jochen Arndt
        wrote on last edited by
        #3

        I would expect it to just send a message to the edit control and therefore be implemented as an inline function when reading CEdit::SetHighlight[^]:

        Quote:

        This method sends the EM_SETHILITE message, which is described in the Windows SDK.

        But getting a linker error assumes that there is a declaration in a header file but no definition (implementation). Following the link from the above quote is even more extraordinary:

        Quote:

        EM_SETHILITE message This message is not implemented.

        A quick research brought up this: What’s the deal with the EM_SETHILITE message? – The Old New Thing[^]. So it looks like that the SetHighlight function uses a not implemented feature and can't be use therefore.

        L 1 Reply Last reply
        0
        • J Jochen Arndt

          I would expect it to just send a message to the edit control and therefore be implemented as an inline function when reading CEdit::SetHighlight[^]:

          Quote:

          This method sends the EM_SETHILITE message, which is described in the Windows SDK.

          But getting a linker error assumes that there is a declaration in a header file but no definition (implementation). Following the link from the above quote is even more extraordinary:

          Quote:

          EM_SETHILITE message This message is not implemented.

          A quick research brought up this: What’s the deal with the EM_SETHILITE message? – The Old New Thing[^]. So it looks like that the SetHighlight function uses a not implemented feature and can't be use therefore.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Yes I found that after posting my reply. However, I would still like to see the linker message.

          L 1 Reply Last reply
          0
          • L Lost User

            Yes I found that after posting my reply. However, I would still like to see the linker message.

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

            The linker message is just going to say no body for prototype function found. The ".H" file contains a prototype header, however the ".c"/".cpp" file contains no body code for that prototype. So the compiler will basically see a forward declaration of a prototype which it will connect but when it gets passed to the linker it can't match the forward declaration to a code body and so it will report that accordingly. The MSDN blog describes the problem they forgot to cull the prototype header before they got locked for compiler release.

            In vino veritas

            A 1 Reply Last reply
            0
            • L Lost User

              What does the error message say?

              A Offline
              A Offline
              AlecJames
              wrote on last edited by
              #6

              Error 1 error LNK2019 : unresolved external symbol "public: void __thiscall CEdit::SetHighlight(int,int)"
              (? SetHighlight@CEdit@@QAEXHH@Z) referenced in function
              "protected: void __thiscall CReceivedMessageEdit::OnLButtonDblClk(unsigned int,class CPoint)"
              (? OnLButtonDblClk@CReceivedMessageEdit@@IAEXIVCPoint@@@Z) C : \...\ReceivedMessageEdit.obj
              Error 2 error LNK1120 : 1 unresolved externals C : \...\123.exe 1 1 123

              1 Reply Last reply
              0
              • L leon de boer

                The linker message is just going to say no body for prototype function found. The ".H" file contains a prototype header, however the ".c"/".cpp" file contains no body code for that prototype. So the compiler will basically see a forward declaration of a prototype which it will connect but when it gets passed to the linker it can't match the forward declaration to a code body and so it will report that accordingly. The MSDN blog describes the problem they forgot to cull the prototype header before they got locked for compiler release.

                In vino veritas

                A Offline
                A Offline
                AlecJames
                wrote on last edited by
                #7

                So the method is unavailable. Any thoughts on how to make an edit box highlight part of its text in a different colour? I thought I would have to write a custom paint routine to do this when I saw SetHighlight.

                J L 2 Replies Last reply
                0
                • A AlecJames

                  So the method is unavailable. Any thoughts on how to make an edit box highlight part of its text in a different colour? I thought I would have to write a custom paint routine to do this when I saw SetHighlight.

                  J Offline
                  J Offline
                  Jochen Arndt
                  wrote on last edited by
                  #8

                  If it is just the current selection and using the default selection colour is appropriate, use the CEdit ES_NOHIDESEL style to show the selection even when the control does not has the focus. Otherwise you may use a CRichEditCtrl.

                  1 Reply Last reply
                  0
                  • A AlecJames

                    So the method is unavailable. Any thoughts on how to make an edit box highlight part of its text in a different colour? I thought I would have to write a custom paint routine to do this when I saw SetHighlight.

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

                    Just override the draw method and put the text onto the DC in whatever colors you want depending on the state.

                    In vino veritas

                    A 1 Reply Last reply
                    0
                    • L leon de boer

                      Just override the draw method and put the text onto the DC in whatever colors you want depending on the state.

                      In vino veritas

                      A Offline
                      A Offline
                      AlecJames
                      wrote on last edited by
                      #10

                      Thanks for the suggestions; ES_NOHIDESEL looks like it will do what I need.

                      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