Driving Ctatic::DrawItem
-
I have an owerdraw ComboBox When a user selects an Item I want to Display the Detail info I figure I could use the same Dialog for Background So for the 6 CStatic and Their 6 Labels I do ShowWindow(SW_HIDE) I saw the following post on how to drive DrawItem by Calling invalidate an the SetWindowText Getting owner draw child control to paint when calling SetWindowText - vc.mfc[^] So I create my own derived CStatic
class MyStatic : public CStatic
{ DECLARE_DYNAMIC(MyStatic)
public:
MyStatic();
~MyStatic();void SetWindowText(LPSTR); void DrawItem(LPDRAWITEMSTRUCT pdis);
};
This my SSetWindowText
void MyStatic::SetWindowText(LPSTR lpsz)
{
Invalidate();
CStatic::SetWindowText(lpsz);}
two bad things on the way to getting where I want 1) I get an exception in wincore.cpp at the retrun ::CallWindowProc
RESULT CWnd::DefWindowProc(UINT nMsg, WPARAM wParam, LPARAM lParam)
{
if (m_pfnSuper != NULL)
return ::CallWindowProc(m_pfnSuper, m_hWnd, nMsg, wParam, lParam);WNDPROC pfnWndProc; if ((pfnWndProc = \*GetSuperWndProcAddr()) == NULL) return ::DefWindowProc(m\_hWnd, nMsg, wParam, lParam); else
- After the exception my Drawitem is called however ItemData doesn't have the String pointer and and is NULL Thanks
-
I have an owerdraw ComboBox When a user selects an Item I want to Display the Detail info I figure I could use the same Dialog for Background So for the 6 CStatic and Their 6 Labels I do ShowWindow(SW_HIDE) I saw the following post on how to drive DrawItem by Calling invalidate an the SetWindowText Getting owner draw child control to paint when calling SetWindowText - vc.mfc[^] So I create my own derived CStatic
class MyStatic : public CStatic
{ DECLARE_DYNAMIC(MyStatic)
public:
MyStatic();
~MyStatic();void SetWindowText(LPSTR); void DrawItem(LPDRAWITEMSTRUCT pdis);
};
This my SSetWindowText
void MyStatic::SetWindowText(LPSTR lpsz)
{
Invalidate();
CStatic::SetWindowText(lpsz);}
two bad things on the way to getting where I want 1) I get an exception in wincore.cpp at the retrun ::CallWindowProc
RESULT CWnd::DefWindowProc(UINT nMsg, WPARAM wParam, LPARAM lParam)
{
if (m_pfnSuper != NULL)
return ::CallWindowProc(m_pfnSuper, m_hWnd, nMsg, wParam, lParam);WNDPROC pfnWndProc; if ((pfnWndProc = \*GetSuperWndProcAddr()) == NULL) return ::DefWindowProc(m\_hWnd, nMsg, wParam, lParam); else
- After the exception my Drawitem is called however ItemData doesn't have the String pointer and and is NULL Thanks