|
|
Comments and Discussions
|
|
 |

|
I derived my own class from COXEdit, everything works fine till i switch compilation to UNICODE.
Now I'm getting strange link errors:
ultimateUnicode error LNK2001: unresolved external symbol "public: virtual int __thiscall COXEdit::SetInputData(wchar_t const *,int)" (?SetInputData@COXEdit@@UAEHPB_WH@Z)
ultimateUnicode error LNK2001: unresolved external symbol "protected: virtual int __thiscall COXEdit::InsertAt(int,wchar_t)" (?InsertAt@COXEdit@@MAEHH_W@Z)
ultimateUnicode error LNK2001: unresolved external symbol "protected: virtual int __thiscall COXEdit::SetAt(int,wchar_t)" (?SetAt@COXEdit@@MAEHH_W@Z)
ultimateUnicode error LNK2001: unresolved external symbol "public: virtual class ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > > __thiscall COXEdit::GetInputData(void)const " (?GetInputData@COXEdit@@UBE?AV?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@XZ)
does enyone konw why it happens?
myclass.h:
class CMEdit : public COXEdit
{
DECLARE_DYNCREATE(CMEdit)
public:
CMEdit();
virtual ~CMEdit();
inline COLORREF GetActiveFont(){return m_clrActiveFont; }
inline COLORREF GetActiveBack(){return m_clrActiveBack; }
inline void SetActiveFont(COLORREF clrNew){m_clrActiveFont = clrNew; }
inline void SetActiveBack(COLORREF clrNew) {m_clrActiveBack = clrNew; }
inline COLORREF GetNormalFont(){return m_clrNormalFont; }
inline COLORREF GetNormalBack(){return m_clrNormalBack; }
inline void SetNormalFont(COLORREF clrNew){m_clrNormalFont = clrNew; }
inline void SetNormalBack(COLORREF clrNew) {m_clrNormalBack = clrNew; }
inline COLORREF GetDisabledFont(){return m_clrDisabledFont; }
inline COLORREF GetDisabledBack(){return m_clrDisabledBack; }
inline void SetDisabledFont(COLORREF clrNew){m_clrDisabledFont = clrNew; }
inline void SetDisabledBack(COLORREF clrNew) {m_clrDisabledBack = clrNew; }
inline BOOL GetActiveMarking() {return m_bEnableActiveMarking;}
inline void SetActiveMarking(BOOL bVal) {m_bEnableActiveMarking = bVal; }
inline BOOL GetAlwaysReadOnly() {return m_bAlwaysReadOnly;}
inline void SetAlwaysReadOnly(BOOL bVal) {m_bAlwaysReadOnly = bVal; }
inline BOOL GetOffColors() {return m_bOffColors;}
inline void SetOffColors(BOOL bVal) {m_bOffColors = bVal; }
protected:
COLORREF m_clrNormalFont; COLORREF m_clrNormalBack;
COLORREF m_clrDisabledFont; COLORREF m_clrDisabledBack;
COLORREF m_clrActiveFont;
COLORREF m_clrActiveBack;
BOOL m_bEnableActiveMarking;
BOOL m_bAlwaysReadOnly;
BOOL m_bOffColors; public:
afx_msg HBRUSH CtlColor(CDC* , UINT );
afx_msg void OnKillFocus(CWnd* pNewWnd);
DECLARE_MESSAGE_MAP()
};
myclass.cpp:
IMPLEMENT_DYNCREATE(CMEdit, COXEdit)
CMEdit::CMEdit():
m_clrNormalBack (c_clrEnabledBack), m_clrNormalFont(c_clrEnabledFont),
m_clrActiveBack(c_clrActiveBack), m_clrActiveFont(c_clrActiveFont),
m_clrDisabledBack(c_clrDisabledBack), m_clrDisabledFont(c_clrDisabledFont),
m_bAlwaysReadOnly(FALSE), m_bEnableActiveMarking(TRUE), m_bOffColors(FALSE)
{
m_clrText = m_clrNormalFont;
m_clrBack = m_clrNormalBack;
EnableActiveAccessibility();
}
CMEdit::~CMEdit()
{
}
BEGIN_MESSAGE_MAP(CMEdit, COXEdit)
ON_WM_CTLCOLOR_REFLECT()
ON_WM_KILLFOCUS()
END_MESSAGE_MAP()
HBRUSH CMEdit::CtlColor(CDC* pDC, UINT nCtlColor)
{
UNREFERENCED_PARAMETER(nCtlColor);
COLORREF newTextColor;
COLORREF newBkColor ;
if(m_bOffColors) { newTextColor = !IsWindowEnabled() ? RGB (80, 80, 80) : GetSysColor(COLOR_WINDOWTEXT); newBkColor = GetSysColor(COLOR_WINDOW); }
else
{
if (!IsWindowEnabled())
{
newTextColor = m_clrDisabledFont;
newBkColor = m_clrDisabledBack;
}
else if(GetStyle()&ES_READONLY)
{
newTextColor = m_clrReadOnlyFont;
newBkColor = m_clrReadOnlyBack;
}
else if(this == GetFocus() && m_bEnableActiveMarking)
{
newTextColor = m_clrActiveFont;
newBkColor = m_clrActiveBack;
}
else
{
newTextColor = m_clrNormalFont ;
newBkColor = m_clrNormalBack ;
}
}
pDC->SetTextColor(newTextColor);
pDC->SetBkColor(newBkColor);
if((HFONT)m_font!=NULL)
pDC->SelectObject(&m_font);
static CBrush brush;
if((HBRUSH)brush!=NULL)
brush.DeleteObject();
brush.CreateSolidBrush(newBkColor);
return (HBRUSH)brush;
}
void CMEdit::OnKillFocus(CWnd* pNewWnd)
{
COXEdit::OnKillFocus(pNewWnd);
RedrawWindow();
}
|
|
|
|

|
I have got some time to check some settings. Both projects (ut library and my project) have to had the same setting for /Zc:wchar_t (wchar_t Is Native Type)
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
|
Updates and User Contributions for the Ultimate Toolbox Libraries
| Type | Article |
| Licence | CPOL |
| First Posted | 22 Apr 2008 |
| Views | 133,594 |
| Bookmarked | 152 times |
|
|