redhat092798
asked on
Creating a list view in a dialog
I have tab controls on my window. The 3 tabs corresponnd to three dialog boxes that I created with CreateDialog(). Up to this point is alright.
I want to create a list view control on my first dialog. The problem is that dialog box does not accept CreateWindow() I think. I can't even create a button on the dialog using CreateWindow(). Of course I can create a button on the .rc file. Anyway, I hope someone has a solution. Basically , this is what I did :-
//procedure for my first dialog
case WM_INITDIALOG:
// create the list view child window
hwndList = CreateWindowEx ( 0, WC_LISTVIEW, "listview"
, WS_VISIBLE | WS_CHILD | LVS_REPORT
, 0, 0, 0, 0
, hwnd
, (HMENU)IDW_LISTVIEW
, hInst
, NULL );
//I know how to create a list view but the problem here is I'm making it on a //dialog
//or show me to create a button using CreateWindow() would be good //enough ( on a dialog)
I want to create a list view control on my first dialog. The problem is that dialog box does not accept CreateWindow() I think. I can't even create a button on the dialog using CreateWindow(). Of course I can create a button on the .rc file. Anyway, I hope someone has a solution. Basically , this is what I did :-
//procedure for my first dialog
case WM_INITDIALOG:
// create the list view child window
hwndList = CreateWindowEx ( 0, WC_LISTVIEW, "listview"
, WS_VISIBLE | WS_CHILD | LVS_REPORT
, 0, 0, 0, 0
, hwnd
, (HMENU)IDW_LISTVIEW
, hInst
, NULL );
//I know how to create a list view but the problem here is I'm making it on a //dialog
//or show me to create a button using CreateWindow() would be good //enough ( on a dialog)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
What is the return value of CreateWindowEx? If it is NULL, call GetLastError. And try it with WM_CREATE instead of WM_INITDIALOG.
ASKER