NO

Author Topic: Listview control column problem  (Read 3349 times)

halsten

  • Guest
Listview control column problem
« on: November 18, 2008, 10:00:58 PM »
I am currently using the Listview control. However, when I insert the columns and run it doesn't show anything. Here's the code that I have used for the process:

Code: [Select]
static void SetupDisasmListView(HWND hwndParent) {
static HWND hWndListView;
static PCHAR szColumnHeader[] = { "Address", "Byte Code", "Disassembly", "Comment" };
static LV_COLUMN        lvC;


ZeroMemory(&lvC, sizeof(lvC));

hWndListView = GetDlgItem(hwndParent, IDC_DISASMLIST);

SendMessage(hWndListView, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT, 0);

lvC.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;

lvC.pszText = (LPWSTR)szColumnHeader[0];
lvC.cx = 0x50;
SendMessage(hWndListView, LVM_INSERTCOLUMN, 0, (LPARAM)&lvC);

lvC.cx = 0x42;
lvC.pszText = (LPWSTR)szColumnHeader[1];
SendMessage(hWndListView, LVM_INSERTCOLUMN, 1, (LPARAM)&lvC);

lvC.cx = 0x42;
lvC.pszText = (LPWSTR)szColumnHeader[2];
SendMessage(hWndListView, LVM_INSERTCOLUMN, 2, (LPARAM)&lvC);

lvC.cx = 0x42;
lvC.pszText = (LPWSTR)szColumnHeader[3];
SendMessage(hWndListView, LVM_INSERTCOLUMN, 3, (LPARAM)&lvC);
}

Am I doing something wrong? Thanks in advance.

Regards,
halsten