If you're using the resource-editor, just drag a "List Box" into your dialog.
Doing it programmatically would be something like this:
HWND listbox= CreateWindowEx(
WS_EX_CLIENTEDGE,
WC_LISTBOX,
title,
WS_CHILD | WS_VISIBLE | WS_BORDER | LBS_NOTIFY | WS_VSCROLL,
xPosition, // position inside the parent wnd
yPosition,
width,
height,
parentWnd, // the parent wnd (your dialog)
(HMENU)id, // some id for the message identification
NULL,
NULL
);
To add items:
char *text="bla"; // assumes you're not using unicode
SendMessage(listbox, LB_ADDSTRING, NULL, (LPARAM)text);
To catch the currently selected item do something like this in your message handler:
case WM_COMMAND:
{
unsigned short lo= LOWORD(wParam);
unsigned short hi= HIWORD(wParam);
switch (lo)
{
case ID_OF_YOUR_LISTBOX:
if (hi == LBN_SELCHANGE || hi == LBN_SELCANCEL)
int selectedIndex = (int)SendMessage(listbox, LB_GETCURSEL, 0, 0);
break;
And enumerating resolutions:
DEVMODE dmi;
int modeNum = 0;
while (EnumDisplaySettings(NULL, modeNum, &dmi))
{
// dmi holds properties of mode:
// width= dmi.dmPelsWidth
// height= dmi.dmPelsHeight
// bits per pixel= dmi.dmBitsPerPel
// refresh in hz= dmi.dmDisplayFrequency
modeNum++;
}