Quote Originally Posted by OReubens View Post
if you want the window to extend out of the dialog... it cannot be a child of the dialog.


I'm guessing you currently have the listbox as part of the dialog template and you are changing the WS_VISIBLE style of the listbox ? This won't work, you'll need to dynamically create a WS_POPUP listbox (WS_POPUP and WS_CHILD are exclusive).
OReubens

Yes indeed. The earlier post from Igor Vartanov pointed me in the right direction.
The listbox is not a child of the main dialog in this case. The .RC looks something like:


IDD_LISTDIALOG DIALOG 30, 80, 130, 120
STYLE WS_POPUP | DS_3DLOOK | WS_VISIBLE
FONT 8, "HELV"
BEGIN
LISTBOX IDC_LISTBOX, 0, 0, 130, 120,
LBS_NOTIFY | WS_CHILD | WS_VISIBLE | WS_BORDER |
WS_VSCROLL | WS_GROUP | WS_TABSTOP | LBS_DISABLENOSCROLL
END

And from the parent dialog (hwnd) call it:

case WM_INITDIALOG:
hLstBx = CreateDialog(_hInstance, MAKEINTRESOURCE(IDD_LISTDIALOG), hwnd, (DLGPROC) ModelessDialogProc);
ShowWindow(hLstBx, SW_HIDE);
SetProp(hwnd, SPEEDLST, (HANDLE) hLstBx);

When the ownerdrawn pushbutton is selected we do a SetWindowPos() to keep the
control in the same area relative to the pushbutton and just do a SW_SHOW.

Worked fine once I got over trying to make the listbox part of the original dialog box !

René