The combobox is the only child window on the main window. And what happens is to it when I use CBS_DROPDOWN style is the text in list that drops down doesn't show up and it freezes the whole application, but my CPU usage on that process says it is zero.
If I press enter when the combobox is selected, it "un-freezes" the application. I also tried making the cy very larege, but it didn't make any difference.
Here is how the window is created:
Code:
void cCHILDWINDOW::Create(const char *pszType, HWND hParent, int cx, int cy, int x, int y,
DWORD dwStyle, DWORD dwExStyle)
{
this->hParent=hParent;
if ( (hwnd=CreateWindowEx(dwExStyle, pszType, NULL, dwStyle | WS_CHILD | WS_VISIBLE,
x, y, cx, cy, hParent, 0, cCOMPONENT::AppInstance, NULL))==0 )
return;
OldChildProc=(WNDPROC)(LRESULT)SetWindowLong(hwnd, GWL_WNDPROC, (LONG)ChildProc);
SendMessage(hwnd, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), TRUE);
}
StepNext goes to the next node in a linkedlist
GetNode gets the current item on the node
StepReset resets the stepper variable to the head of the linked-list
The code in the WndProc:
Code:
LRESULT CALLBACK cWINDEX::WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
cLINKEDLIST<cCHILDWINDOW*> *ChildWindow=&cWINDOW::Objects->ChildWindow;
if ( ChildWindow->Count()> 0 )
{
ChildWindow->StepReset();
do
{
if ( (ChildWindow->GetNode())->ProcessParent(hwnd, message, wParam, lParam) )
return DefWindowProc(hwnd, message, wParam, lParam);
}while ( ChildWindow->StepNext() );
}
.
.
.
return DefWindowProc(hwnd, message, wParam, lParam);
}
Code in sub-classed window (the 'return 0' will never be reached. It is only there to remove a warning):
Code:
LRESULT CALLBACK cCHILDWINDOW::ChildProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
cCHILDWINDOW *TempChild;
cLINKEDLIST<cCHILDWINDOW*> *ChildWindow=&cWINDOW::Objects->ChildWindow;
if ( ChildWindow->Count()>0 )
{
ChildWindow->StepReset();
do
{
TempChild=ChildWindow->GetNode();
if ( hwnd==*TempChild )
{
TempChild->ProcessEvents(hwnd, message, wParam, lParam);
return CallWindowProc(TempChild->OldChildProc, hwnd, message, wParam, lParam);
}
}while ( ChildWindow->StepNext() );
}
return 0;
}
Thanks in advance,
Joe