HWND create_listview(listview_cb listviewcb)
{
HWND h_listview;
LVCOLUMN lvcol;
int Loop;
h_listview = CreateWindowEx(CTRL_LISTVIEW,"",listviewcb.dwStyle,listviewcb.dwExStyle,listviewcb.id,listviewcb.x,\
listviewcb.y,listviewcb.w,listviewcb.h,listviewcb.hParentWnd,listviewcb.dwAddData);
SendMessage(h_listview,LVM_SETHEADHEIGHT,listviewcb.title_h,0);
if (listviewcb.col_cnt>sizeof(listviewcb.col_w)/sizeof(int))
{
printf("%s,%d,%s",__FILE__,__LINE__,"listview col cnt biger than the MAX");
return 0;
}
for (Loop=0; Loop<listviewcb.col_cnt; Loop++)
{
lvcol.nCols = Loop;
lvcol.pszHeadText = "hello";
lvcol.width = listviewcb.col_w[Loop];
lvcol.pfnCompare = NULL;
lvcol.colFlags = 0;
SendMessage (h_listview, LVM_ADDCOLUMN, 0, (LPARAM) &lvcol);
}
return h_listview;
}
{
HWND h_listview;
LVCOLUMN lvcol;
int Loop;
h_listview = CreateWindowEx(CTRL_LISTVIEW,"",listviewcb.dwStyle,listviewcb.dwExStyle,listviewcb.id,listviewcb.x,\
listviewcb.y,listviewcb.w,listviewcb.h,listviewcb.hParentWnd,listviewcb.dwAddData);
SendMessage(h_listview,LVM_SETHEADHEIGHT,listviewcb.title_h,0);
if (listviewcb.col_cnt>sizeof(listviewcb.col_w)/sizeof(int))
{
printf("%s,%d,%s",__FILE__,__LINE__,"listview col cnt biger than the MAX");
return 0;
}
for (Loop=0; Loop<listviewcb.col_cnt; Loop++)
{
lvcol.nCols = Loop;
lvcol.pszHeadText = "hello";
lvcol.width = listviewcb.col_w[Loop];
lvcol.pfnCompare = NULL;
lvcol.colFlags = 0;
SendMessage (h_listview, LVM_ADDCOLUMN, 0, (LPARAM) &lvcol);
}
return h_listview;
}