CEdit::SetHighlight
-
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?
-
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?
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. -
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. -
Yes I found that after posting my reply. However, I would still like to see the linker message.
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
-
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 -
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
-
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.
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 aCRichEditCtrl
. -
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.
Just override the draw method and put the text onto the DC in whatever colors you want depending on the state.
In vino veritas
-
Just override the draw method and put the text onto the DC in whatever colors you want depending on the state.
In vino veritas