The code in red is where I think the problem lies.
This is how I create the ListBox (I would specifiy "LISTBOX" in the pszType field):
Code:
void cCHILDWINDOW::Create(const char *pszType, HWND hwnd, int cx, int cy, int x, int y, DWORD dwStyle, DWORD dwExStyle)
{
this->hParent=hwnd;
this->hwnd=CreateWindowEx(dwExStyle, pszType, NULL, dwStyle | WS_CHILD | WS_VISIBLE,
x, y, cx, cy, hParent, NULL, 0, NULL);
OldChildProc=(WNDPROC)SetWindowLong(this->hwnd, GWL_WNDPROC, (LONG)ChildProc);
SendMessage(this->hwnd, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), TRUE);
}
Here is the procedure for the subclass:
Code:
LRESULT CALLBACK cCHILDWINDOW::ChildProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
cCHILDWINDOW **TempChild;
cLINKEDLIST<cCHILDWINDOW*> *ChildWindow=&cWINDOW::ChildWindow;
if ( ChildWindow->Count() )
{
//Finds the window message was sent to
ChildWindow->Reset();
do
{
if ( hwnd==**(TempChild=ChildWindow->Node()) )
break;
}
while ( ChildWindow->Next() );
//Call the default function for default actions to happen
CallWindowProc((*TempChild)->OldChildProc, (*TempChild)->hwnd, message, wParam, lParam);
(*TempChild)->ProcessEvents(hwnd, message, wParam, lParam);
}
return 1;
}
The problem is that when I try to get the listbox count it always says its one. Even with the CallWindowProc included.
Does anyone know why this is happening?
Thanks