CComboBox Fails to Create
Posted on 2006-10-31
I have a CComboBox, which is restricted to a ListBox via its property sheet. It is part of a much larger and complex dialog, which is part of a much more complex multi-page tab control. In other words, there is a lot going on.
The dialogs are created by stepping through a loop that creates and attached each dialog to the tab control. After the creation step, I load a few CComboBoxes with static data such as states in the union, etc.
Everything works fine on the development machines, but fails when the program is loaded on a 98 Home Edition machine.
The failure seems to be on a call to ResetAll() on one of the combo boxes. I KNOW, a ResetAll isn't required if the combobox has just been created---somebody got too diligent. However, it did raise an interesting question of how to avoid the problem. On a lark, I placed something that resembled
while(!IsWindow(mydialog->mycombobox.m_hWnd)); //I'll clean this up later
Again this works perfectly, or at least reports no failures on any of the development machines. However when moved to a non-development XP Hmoe Edition machine, it fails with an assertion, a file name and a line number. When I examine the file in question it indicates that the problem is that m_hWnd is not a Window.
Does anyone have any idea why this is happening. I'm still working on a work-around, but for the sake of my sanity, I'd like to know the answer.
Thanks in advance, Rick