Re: Owner draw combo box & OCM_DRAWITEM
You should not use SubclassWindow if you are already calling
Create. Sorry for not making this clearer in my previous post.
However, I'm confused as to how you are getting a standard
combo-box if you don't use DECLARE_WND_SUPERCLASS. By
default CWindowImpl creates a new window class for you.
Anyway, I should probably have started from the other end. Is
your combo-box owner-drawn? It won't dispatch WM_DRAWITEM
messages unless it is owner-drawn.
--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@mvps.org
MVP VC FAQ: http://vcfaq.mvps.org
=====================================
"Dave" <blueturtle@walla.co.il> wrote in message
news:1186492835.608962.127090@l70g2000hse.googlegroups.com...
Hi,
I'm sorry but I don't understand you.
This is a huge project which was programmed by someone which I cannot
access, and my 1st time using WTL, so maybe I'm missing something.
The class "MyCombo" is not using DECLARE_WND_SUPERCLASS.
However, I cannot call SubclassWindow, because I will get assert in
the 1st test (ATLASSERT(m_hWnd == NULL);) in:
BOOL CWindowImplBaseT< TBase, TWinTraits >::SubclassWindow(HWND hWnd)
{
ATLASSERT(m_hWnd == NULL);
Except for the problem I've mentioned in the 1st post, everything
_seem_ to work ok.
Regarding what u wrote:
"This won't create a combo-box - it'll create a new window class for
you and create a window of that class".
When I put a breakpoint in CComboBox, I stop, so I dont understand
what u mean.
Here a sample snapshot of the stack:
MyDLL.dll!WTL::CComboBoxT<ATL::CWindow>::GetCurSel() Line 763
MyDLL.dll!Toolbar::MyCombo::OnSelChanged(...) Line 1861 + 0xe C++
MyDLL.dll!Toolbar::MyCombo::_ProcessWindowMessage(...) Line 386 +
0x3f C++
MyDLL.dll!Toolbar::MyCombo::ProcessWindowMessage(...) Line 385 + 0x55
C++
MyDLL.dll!
ATL::CWindowImplBaseT<WTL::CComboBoxT<ATL::CWindow>,ATL::CWinTraits<1442840576,0>
::WindowProc(...) Line 3012 + 0x25 C++
Regarding my 1st post, where do u think I should look for the
problem ?
Thanks again and again for your help.
Si.