Exemplo n.º 1
0
HRESULT CLAVAudioFormatsProp::OnActivate()
{
  HRESULT hr = S_OK;
  INITCOMMONCONTROLSEX icc;
  icc.dwSize = sizeof(INITCOMMONCONTROLSEX);
  icc.dwICC = ICC_BAR_CLASSES | ICC_STANDARD_CLASSES | ICC_LISTVIEW_CLASSES;
  if (InitCommonControlsEx(&icc) == FALSE)
  {
    return E_FAIL;
  }
  ASSERT(m_pAudioSettings != nullptr);

  // Setup ListView control for format configuration
  HWND hlv = GetDlgItem(m_Dlg, IDC_CODECS);
  ListView_SetExtendedListViewStyle(hlv, LVS_EX_CHECKBOXES|LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES);

  int nCol = 1;
  LVCOLUMN lvc = {LVCF_WIDTH, 0, 20, 0};
  ListView_InsertColumn(hlv, 0, &lvc);
  ListView_AddCol(hlv, nCol,  75, L"Codec", false);
  ListView_AddCol(hlv, nCol, 350, L"Description", false);

  ListView_DeleteAllItems(hlv);
  ListView_SetItemCount(hlv, Codec_AudioNB);

  // Create entries for the formats
  LVITEM lvi;
  memset(&lvi, 0, sizeof(lvi));
  lvi.mask = LVIF_TEXT|LVIF_PARAM;

  int nItem = 0;
  for (nItem = 0; nItem < Codec_AudioNB; ++nItem) {
    const codec_config_t *config = get_codec_config((LAVAudioCodec)nItem);

    // Create main entry
    lvi.iItem = nItem + 1;
    ListView_InsertItem(hlv, &lvi);

    // Set sub item texts
    ATL::CA2W name(config->name);
    ListView_SetItemText(hlv, nItem, 1, (LPWSTR)name);

    ATL::CA2W desc(config->description);
    ListView_SetItemText(hlv, nItem, 2, (LPWSTR)desc);
  }

  hr = LoadData();
  if (SUCCEEDED(hr)) {
    // Set checked state
    for (nItem = 0; nItem < ListView_GetItemCount(hlv); nItem++) {
      ListView_SetCheckState(hlv, nItem, m_bFormats[nItem]);
    }
  }

  return hr;
}
Exemplo n.º 2
0
void COpenSubDlg::InitializeList()
{
    ListView_SetExtendedListViewStyle(m_results_list_control.m_hWnd, LVS_EX_FULLROWSELECT | LVS_EX_INFOTIP);

    CRect rect;
    m_results_list_control.GetClientRect(&rect);
    int nColInterval = rect.Width() / 8;
    m_results_list_control.InsertColumn(0, L"Count", LVCFMT_CENTER, nColInterval);
    m_results_list_control.InsertColumn(1, L"Name", LVCFMT_LEFT, nColInterval * 7);
}
Exemplo n.º 3
0
void TableViewImpl::setExtendedStyleFlag(long flag, bool value)
{
    auto style = ListView_GetExtendedListViewStyle(hWnd);
    if( value ) {
        style |= flag;
    } else {
        style &= ~flag;
    }
    ListView_SetExtendedListViewStyle(hWnd,style);
}
Exemplo n.º 4
0
static VOID
OnInitDialog(HWND hwndDlg)
{
    HWND hwndListView;

    /* Set user environment variables */
    hwndListView = GetDlgItem(hwndDlg, IDC_USER_VARIABLE_LIST);

    (void)ListView_SetExtendedListViewStyle(hwndListView, LVS_EX_FULLROWSELECT);

    SetListViewColumns(hwndListView);

    GetEnvironmentVariables(hwndListView,
                            HKEY_CURRENT_USER,
                            _T("Environment"));

    (void)ListView_SetColumnWidth(hwndListView, 2, LVSCW_AUTOSIZE_USEHEADER);

    ListView_SetItemState(hwndListView, 0,
                          LVIS_FOCUSED | LVIS_SELECTED,
                          LVIS_FOCUSED | LVIS_SELECTED);

    (void)ListView_Update(hwndListView,0);

    /* Set system environment variables */
    hwndListView = GetDlgItem(hwndDlg, IDC_SYSTEM_VARIABLE_LIST);

    (void)ListView_SetExtendedListViewStyle(hwndListView, LVS_EX_FULLROWSELECT);

    SetListViewColumns(hwndListView);

    GetEnvironmentVariables(hwndListView,
                            HKEY_LOCAL_MACHINE,
                            _T("SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment"));

    (void)ListView_SetColumnWidth(hwndListView, 2, LVSCW_AUTOSIZE_USEHEADER);

    ListView_SetItemState(hwndListView, 0,
                          LVIS_FOCUSED | LVIS_SELECTED,
                          LVIS_FOCUSED | LVIS_SELECTED);

    (void)ListView_Update(hwndListView, 0);
}
SensorListControl::SensorListControl(HWND hWnd)
    : CustomDrawListControl(hWnd, Columns)
{
    EnsureImageLoaded(SensorPicture, IDB_KINECTSENSORPICTURE);
    EnsureFontCreated(StatusLargeFont, 25, FW_MEDIUM);

    ListView_SetExtendedListViewStyle(m_hWnd, ListView_GetExtendedListViewStyle(m_hWnd) | LVS_EX_SUBITEMIMAGES);

    HIMAGELIST hImgList = ImageList_Create(SensorListImageWidth, SensorListRowHeight, ILC_COLORDDB, 1, 1);
    ListView_SetImageList(m_hWnd, hImgList, LVSIL_SMALL);
}
Exemplo n.º 6
0
TableViewImpl * TableViewImpl::clone() const
{
    auto result = std::make_unique<TableViewImpl>(getParentHandle(),getControlData());    
    ListView_SetExtendedListViewStyle(result->hWnd,ListView_GetExtendedListViewStyle(hWnd));
    result->imageListImpl = imageListImpl;
    for( int c = 0; c != colCount; ++c ) {
        result->addColumn(column(c));
    }
    result->setRows(rowCount);
    return result.release();
}
Exemplo n.º 7
0
/*
* FindDlgCreate
*
* Purpose:
*
* Create and initialize Find Dialog.
*
*/
VOID FindDlgCreate(
    _In_ HWND hwndParent
)
{
    LVCOLUMN col;
    HICON    hIcon;

    //do not allow second copy
    if (g_wobjDialogs[WOBJ_FINDDLG_IDX]) {
        SetActiveWindow(g_wobjDialogs[WOBJ_FINDDLG_IDX]);
        return;
    }

    FindDialog = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_DIALOG_SEARCH), hwndParent, &FindDlgProc, 0);
    if (FindDialog == NULL) {
        return;
    }
    g_wobjDialogs[WOBJ_FINDDLG_IDX] = FindDialog;

    FindDlgGrip = supCreateSzGripWindow(FindDialog);

    //set dialog icon, because we use shared dlg template this icon must be
    //removed after use, see aboutDlg/propDlg.
    hIcon = LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_ICON_MAIN), IMAGE_ICON, 0, 0, LR_SHARED);
    if (hIcon) {
        SetClassLongPtr(g_wobjDialogs[WOBJ_FINDDLG_IDX], GCLP_HICON, (LONG_PTR)hIcon);
        DestroyIcon(hIcon);
    }

    FindDlgList = GetDlgItem(FindDialog, ID_SEARCH_LIST);
    if (FindDlgList) {
        bFindDlgSortInverse = FALSE;
        ListView_SetImageList(FindDlgList, ListViewImages, LVSIL_SMALL);
        ListView_SetExtendedListViewStyle(FindDlgList, LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER | LVS_EX_GRIDLINES | LVS_EX_LABELTIP);

        RtlSecureZeroMemory(&col, sizeof(col));
        col.mask = LVCF_TEXT | LVCF_SUBITEM | LVCF_FMT | LVCF_WIDTH | LVCF_ORDER | LVCF_IMAGE;
        col.iSubItem = 1;
        col.pszText = TEXT("Name");
        col.fmt = LVCFMT_LEFT | LVCFMT_BITMAP_ON_RIGHT;
        col.iOrder = 0;
        col.iImage = ImageList_GetImageCount(ListViewImages) - 1;
        col.cx = 300;
        ListView_InsertColumn(FindDlgList, 1, &col);

        col.iSubItem = 2;
        col.pszText = TEXT("Type");
        col.iOrder = 1;
        col.iImage = -1;
        col.cx = 100;
        ListView_InsertColumn(FindDlgList, 2, &col);
    }
    FindDlgAddTypes(FindDialog);
}
Exemplo n.º 8
0
void CPlayListDlg::OnInitDialog(HWND hwndDlg)
{
	m_hWnd = hwndDlg;
	ShellInitDialog(m_hWnd);

	// ツールバーの準備
	SHMENUBARINFO mbi;
	memset(&mbi, 0, sizeof(SHMENUBARINFO));
	mbi.cbSize = sizeof(SHMENUBARINFO);
	mbi.hwndParent = m_hWnd;
	mbi.nToolBarId = IDR_DUMMY;
	mbi.hInstRes = GetInst();
	SHCreateMenuBar(&mbi);
	m_hwndMB = mbi.hwndMB;

	SendMessage(m_hwndMB, TB_DELETEBUTTON, 0, 0);
	SendMessage(m_hwndMB, TB_ADDSTRING, (WPARAM)GetInst(), IDC_UP);
	SendMessage(m_hwndMB, TB_ADDSTRING, (WPARAM)GetInst(), IDC_DOWN);

	CommandBar_AddBitmap(m_hwndMB, GetInst(), IDR_PLAYLIST, 6, 16, 16);
	TBBUTTON tbbMain[] = {
		{0, IDC_ADD, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
		{1, IDC_UP, TBSTATE_ENABLED, TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE, 0, 0, 0, 0},
		{2, IDC_DOWN, TBSTATE_ENABLED, TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE, 0, 0, 0, 1},
		{3, IDC_DELETE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
		{4, IDC_SAVE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
		{5, IDC_CTRLKEY, TBSTATE_ENABLED, TBSTYLE_CHECK, 0, 0, 0, -1}
	};

	for (int i = 0; i < sizeof(tbbMain) / sizeof(TBBUTTON); i++) {
		CommandBar_InsertButton(m_hwndMB, i, &tbbMain[i]);
	}

	// リストの準備
	HWND hwndLV = GetDlgItem(m_hWnd, IDC_PLAY_LIST);
	ListView_SetExtendedListViewStyle(hwndLV, 
		ListView_GetExtendedListViewStyle(hwndLV) | LVS_EX_FULLROWSELECT);

	// カラムの挿入
	LVCOLUMN lvc;
	lvc.mask = LVCF_FMT | LVCF_SUBITEM | LVCF_TEXT | LVCF_WIDTH;
	lvc.fmt = LVCFMT_LEFT;
	lvc.cx = 0;
	lvc.pszText = _T("Name");
	lvc.iSubItem = 0;
	ListView_InsertColumn(hwndLV, 0, &lvc);
	
	// イメージリストを設定
	ListView_SetImageList(hwndLV, m_hImageList, LVSIL_SMALL);

	// リストを更新
	UpdatePlayList();
}
Exemplo n.º 9
0
INT_PTR CALLBACK UserIdDialogProcedure(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
{
    static char *keyid;
    HWND hLV = GetDlgItem(hdlg,IDC_KEYLIST);

    switch(msg)
    {
    case WM_INITDIALOG:
    {
        int i;
        LVCOLUMN lvc;
        static char *szColHdr[] = { "Key ID", "User ID" };
        static int iColWidth[] = { 110, 255 };
        keyid = (char *)lparam;

        ZeroMemory(&lvc,sizeof(LVCOLUMN));
        lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
        lvc.fmt = LVCFMT_LEFT;
        for (i = 0; i < 2; i++) {
            lvc.iSubItem = i;
            lvc.pszText = szColHdr[i];
            lvc.cx = iColWidth[i];
            ListView_InsertColumn(hLV, i, &lvc);
        }

        RefreshListView(hLV);

        ListView_SetExtendedListViewStyle(hLV, ListView_GetExtendedListViewStyle(hLV) | LVS_EX_FULLROWSELECT);
        ListView_SetItemState(hLV, 0, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED);
        EnableWindow(hLV, TRUE);
    }
    break;
    case WM_COMMAND:
        switch(LOWORD(wparam))
        {
        case IDOK:
            ListView_GetItemText(hLV, ListView_GetNextItem(hLV, -1, LVNI_SELECTED), 0, keyid, keyidsize);
        case IDCANCEL:
            EndDialog(hdlg, wparam);
            return TRUE;
            break;
        case IDC_REFRESH:
            updateKeyUserIDs(publickeyuserid);
            updateKeyUserIDs(secretkeyuserid);
            RefreshListView(hLV);
            break;
        }
        break;
    }

    return FALSE;
}
Exemplo n.º 10
0
void TconvolverPage::init(void)
{
    tbrSetRange(IDC_TBR_CONVOLVER_MIXINGSTRENGTH,0,100);
    tbrSetRange(IDC_TBR_CONVOLVER_LEVELADJUSTDB,-300,300);
    hlv=GetDlgItem(m_hwnd,IDC_LV_CONVOLVER_FILES);
    int ncol=0;
    ListView_AddCol(hlv,ncol,cfgGet(IDFF_lvConvolverWidth0),_(IDC_LV_CONVOLVER_FILES,_l("Channel")),false);
    ListView_AddCol(hlv,ncol,cfgGet(IDFF_lvConvolverWidth1),_(IDC_LV_CONVOLVER_FILES,_l("File")),false);
    ListView_AddCol(hlv,ncol,cfgGet(IDFF_lvConvolverWidth2),_(IDC_LV_CONVOLVER_FILES,_l("Format")),false);
    ListView_SetExtendedListViewStyle(hlv,ListView_GetExtendedListViewStyle(hlv)|LVS_EX_FULLROWSELECT);
    ListView_SetItemCount(hlv,6);
    lvSetSelItem(IDC_LV_CONVOLVER_FILES,cfgGet(IDFF_lvConvolverSelected));
}
Exemplo n.º 11
0
void TkeysPage::init(void)
{
    keyChanging = -1;
    ignoreNextKey = false;

    hlv = GetDlgItem(m_hwnd, IDC_LV_KEYS);

    int ncol = 0;
    ListView_AddCol(hlv, ncol, cfgGet(IDFF_lvKeysWidth0), _l("Action"), false);
    ListView_AddCol(hlv, ncol, cfgGet(IDFF_lvKeysWidth1), _l("Key"), false);
    ListView_SetExtendedListViewStyle(hlv, ListView_GetExtendedListViewStyle(hlv) | LVS_EX_FULLROWSELECT);
    ListView_SetItemCount(hlv, deciD->getKeyParamCount2());
}
Exemplo n.º 12
0
//----------------------------------------------------------------------------------------------------------------------
//  INSERT IMAGE LISTS
//----------------------------------------------------------------------------------------------------------------------
void cListViewComputers :: insert_image_lists ( HWND hwnd )
{ 
	HANDLE hStateBlue = 0;
	HANDLE hStateGold = 0;
	HANDLE hStateGray = 0;

	//-----------------------------------
	// INSERT IMAGES IN ORDER
	// 0 == GRAY == NO CONNECTIONS
	// 1 == GOLD == ONE-WAY CONNECTION
	// 2 == BLUE == TWO-WAY CONNECTION
	//-----------------------------------

	HANDLE hDeskStraightGray = LoadImage ( g_hInstance, MAKEINTRESOURCE ( IDI_COMPUTER_GRAY ), 
	 	                      IMAGE_ICON, 85, 73, LR_CREATEDIBSECTION );

	HANDLE hDeskStraightGold = LoadImage ( g_hInstance, MAKEINTRESOURCE ( IDI_COMPUTER_GOLD), // returns 0 on fail
	 	                      IMAGE_ICON, 85, 73, LR_CREATEDIBSECTION | LR_LOADTRANSPARENT );

	HANDLE hDeskStraightBlue = LoadImage ( g_hInstance, MAKEINTRESOURCE ( IDI_COMPUTER_BLUE ), 
	 	                      IMAGE_ICON, 85, 73, LR_CREATEDIBSECTION );


	hStateGray = LoadImage ( g_hInstance, MAKEINTRESOURCE ( IDI_CONNECTION_STATE_GRAY ), 
	 	                      IMAGE_ICON, 16,24, LR_CREATEDIBSECTION );

	hStateGold = LoadImage ( g_hInstance, MAKEINTRESOURCE ( IDI_CONNECTION_STATE_GOLD ), 
	 	                      IMAGE_ICON, 16,24, LR_CREATEDIBSECTION );

	hStateBlue = LoadImage ( g_hInstance, MAKEINTRESOURCE ( IDI_CONNECTION_STATE_BLUE ), 
	 	                      IMAGE_ICON, 16,24, LR_CREATEDIBSECTION );

    hImageListLarge = ImageList_Create ( 85, 73, ILC_MASK | ILC_COLORDDB | ILC_COLOR32, 3, 0 );
	HRESULT iResult = ImageList_AddIcon ( hImageListLarge, (HICON)hDeskStraightGray );
	iResult = ImageList_AddIcon ( hImageListLarge, (HICON)hDeskStraightGold );
	iResult = ImageList_AddIcon ( hImageListLarge, (HICON)hDeskStraightBlue );

	hImageListState = ImageList_Create ( 16, 24, ILC_MASK | ILC_COLORDDB | ILC_COLOR32, 3, 0 );
	iResult = ImageList_AddIcon ( hImageListState, (HICON)hStateGray);
	iResult = ImageList_AddIcon ( hImageListState, (HICON)hStateGold );
	iResult = ImageList_AddIcon ( hImageListState, (HICON)hStateBlue );

	HIMAGELIST hResult = ListView_SetImageList ( hwnd, hImageListLarge, LVSIL_NORMAL ); 
	ListView_SetExtendedListViewStyle ( hwnd, LVS_EX_BORDERSELECT | LVS_EX_DOUBLEBUFFER | LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP );
	hResult = ListView_SetImageList ( hwnd, hImageListState, LVSIL_STATE );
	HWND hHeader = ListView_GetHeader ( hwnd );
	RECT rect;
	GetWindowRect ( hHeader, & rect );
	MoveWindow ( hHeader, rect.left, rect.top, 200, 100, TRUE );
	ShowWindow ( hHeader, SW_NORMAL );
}
Exemplo n.º 13
0
BOOL LV_Init(HWND hwnd)
{
    ListView_SetExtendedListViewStyle(hwnd,
        LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES);

    HIMAGELIST hImageList;
    hImageList = ImageList_Create(12, 12, ILC_COLOR8 | ILC_MASK, 2, 2);

    HBITMAP hbm;
    hbm = (HBITMAP)LoadImage(g_hInstance, MAKEINTRESOURCE(2), IMAGE_BITMAP,
                             12, 12, LR_CREATEDIBSECTION | LR_LOADMAP3DCOLORS);
    assert(hbm);
    ImageList_AddMasked(hImageList, hbm, RGB(192, 192, 192));
    DeleteObject(hbm);

    hbm = (HBITMAP)LoadImage(g_hInstance, MAKEINTRESOURCE(3), IMAGE_BITMAP,
                             12, 12, LR_CREATEDIBSECTION | LR_LOADMAP3DCOLORS);
    assert(hbm);
    ImageList_AddMasked(hImageList, hbm, RGB(192, 192, 192));
    DeleteObject(hbm);

    hbm = (HBITMAP)LoadImage(g_hInstance, MAKEINTRESOURCE(4), IMAGE_BITMAP,
                             12, 12, LR_CREATEDIBSECTION | LR_LOADMAP3DCOLORS);
    assert(hbm);
    ImageList_AddMasked(hImageList, hbm, RGB(192, 192, 192));
    DeleteObject(hbm);

    ListView_SetImageList(hwnd, hImageList, LVSIL_SMALL);

    LV_COLUMNW Column;
    ZeroMemory(&Column, sizeof(Column));
    Column.mask = LVCF_FMT | LVCF_TEXT | LVCF_SUBITEM | LVCF_WIDTH | LVCF_IMAGE;
    Column.fmt = LVCFMT_LEFT;

    Column.cx = NAME_COLUMN_WIDTH;
    Column.pszText = g_szNameHead;
    Column.iSubItem = 0;
    Column.iImage = 0;
    ListView_InsertColumn(hwnd, 0, &Column);

    Column.cx = SUB_COLUMN_WIDTH;
    Column.pszText = g_szSubstituteHead;
    Column.iSubItem = 1;
    Column.iImage = 2;
    ListView_InsertColumn(hwnd, 1, &Column);

    UINT State = LVIS_SELECTED | LVIS_FOCUSED;
    ListView_SetItemState(hwnd, 0, State, State);

    return TRUE;
}
Exemplo n.º 14
0
void CreateChildControl(HWND hwnd)
{
	CreateWindow("edit", "▶ 프로세스 목록", WS_CHILD | WS_VISIBLE,
		10,10, 200, 20, hwnd, NULL, GetModuleHandle(0), NULL);

	//------------- LISTVIEW 컨트롤 초기화(MAINLIST) -------------------------------
	LVCOLUMN COL;

	hMainList = CreateWindow(WC_LISTVIEW, NULL, WS_CHILD| WS_VISIBLE|WS_BORDER|
		LVS_REPORT,10, 30, 500, 420, hwnd, NULL, GetModuleHandle(0), NULL);

	// p890 행 전체 선택 & 격자 표시하기 
	ListView_SetExtendedListViewStyle(hMainList, 
		LVS_EX_CHECKBOXES|LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES|LVS_EX_HEADERDRAGDROP|LVS_EX_INFOTIP);

	COL.mask	= LVCF_FMT|LVCF_WIDTH|LVCF_TEXT|LVCF_SUBITEM;
	COL.fmt		= LVCFMT_LEFT;
	COL.cx		= 100;
	COL.pszText	= "이미지 이름";
	COL.iSubItem= 0;
	SendMessage(hMainList, LVM_INSERTCOLUMN, 0, (LPARAM)&COL);

	COL.cx = 150;
	COL.pszText	= "PID";
	COL.iSubItem=1;
	SendMessage(hMainList, LVM_INSERTCOLUMN, 1, (LPARAM)&COL);

	COL.cx = 150;
	COL.pszText	= "스레드";
	COL.iSubItem=2;
	SendMessage(hMainList, LVM_INSERTCOLUMN, 2, (LPARAM)&COL);

	//--------------------------------------------------------------------

	//------------- BUTTON CONTROL 초기화 -------------------------------
	hBtnRefresh = CreateWindow( "button", "목록 업데이트", 
		WS_CHILD | WS_VISIBLE | WS_BORDER,
		10,460,160,30, hwnd, (HMENU)IDC_BTNREFRESH, 0,0);

	hBtnTerminateProcess = CreateWindow( "button", "프로세스 끝내기", 
		WS_CHILD | WS_VISIBLE | WS_BORDER,
		180,460,160,30, hwnd, (HMENU)IDC_BTNTERMINATEPROCESS, 0,0);

	hBtnSpy = CreateWindow( "button", "프로세스 감시", 
		WS_CHILD | WS_VISIBLE | WS_BORDER,
		350,460,160,30, hwnd, (HMENU)IDC_BTNSPY, 0,0);

	hStaticLog = CreateWindow( "static", "", 
		WS_CHILD | WS_VISIBLE | WS_BORDER,
		10, 500, 500, 30, hwnd, (HMENU)IDC_LOG, 0,0);
}
Exemplo n.º 15
0
void CDialogOptionLanguage::LoadListCtrl()
{
    // 设置显示属性
    ListView_SetExtendedListViewStyle(m_listLanguages,
        LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_CHECKBOXES);
    m_listLanguages.SetBkColor(GetSysColor(COLOR_3DFACE));
    m_listLanguages.SetTextBkColor(GetSysColor(COLOR_WINDOW));
    m_listLanguages.SetTextColor(GetSysColor(COLOR_WINDOWTEXT));
    
    // 设置列名称
    m_listLanguages.InsertColumn(0, "LANGUAGE");
    m_listLanguages.SetColumnWidth(0, 130);
    m_listLanguages.InsertColumn(1, "LANGUAGE NAME");
    m_listLanguages.SetColumnWidth(1, 130);
    m_listLanguages.InsertColumn(2, "AVAILABLE");
    m_listLanguages.SetColumnWidth(2, 71);

    // 加载INI文件中的语言列表
    CIni Ini(m_pdlgMain->m_strLanguageFile);

    CString strLanguageList = Ini.ReadText("Index", "LanguageList");
    strLanguageList += ",";
    
    int iStart = 0;
    int iEnd = 0;
    while (iStart <= strLanguageList.GetLength() - 1)
    {
        CString strLanguageId;
        iEnd = strLanguageList.Find(',', iStart);
        strLanguageId = strLanguageList.Mid(iStart, iEnd - iStart);
        strLanguageId.TrimLeft();
        strLanguageId.TrimRight();
        
        BOOL bLanguageNameExist;
        BOOL bLanguageAvailableExist;
        bLanguageNameExist = Ini.CheckExist(strLanguageId, "LanguageName");
        bLanguageAvailableExist = Ini.CheckExist(strLanguageId, "Available");
        if (bLanguageNameExist && bLanguageAvailableExist)
        {
            CString strLanguageName;
            strLanguageName = Ini.ReadText(strLanguageId, "LanguageName");
            
            BOOL bLanguageAvailable;
            bLanguageAvailable = Ini.ReadInt(strLanguageId, "Available");
            
            InsertItem(strLanguageId.GetBuffer(0), strLanguageName.GetBuffer(0), bLanguageAvailable);
        }
        iStart = iEnd + 1;
    }
}
Exemplo n.º 16
0
int CPropertiesList::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
  lpCreateStruct->style|=WS_HSCROLL|WS_VSCROLL|LVS_REPORT|LVS_REPORT|LVS_SINGLESEL;
	if (CListCtrl::OnCreate(lpCreateStruct) == -1)
		return -1;

  //GetHeaderCtrl()->ModifyStyle(HDS_FULLDRAG,0,0); // remove HDS_FULLDRAG style from header
	
	ListView_SetExtendedListViewStyle(GetSafeHwnd(),/*LVS_EX_GRIDLINES|*/LVS_EX_FULLROWSELECT/*|LVS_EX_ONECLICKACTIVATE*//*|LVS_EX_TRACKSELECT*/);
	InsertColumn(0,_T("Property"),LVCFMT_LEFT,0,0);	
	InsertColumn(1,_T("Value"),LVCFMT_LEFT,0,1);	

	return 0;
}
Exemplo n.º 17
0
static VOID
InitializeDevicesList(IN PHARDWARE_PAGE_DATA hpd)
{
    LVCOLUMN lvc;
    RECT rcClient;
    WCHAR szColName[255];
    int iCol = 0;

    /* set the list view style */
    (void)ListView_SetExtendedListViewStyle(hpd->hWndDevList,
                                            LVS_EX_FULLROWSELECT);

    /* set the list view image list */
    if (hpd->ClassImageListData.ImageList != NULL)
    {
        (void)ListView_SetImageList(hpd->hWndDevList,
                                    hpd->ClassImageListData.ImageList,
                                    LVSIL_SMALL);
    }

    GetClientRect(hpd->hWndDevList,
                  &rcClient);

    /* add the list view columns */
    lvc.mask = LVCF_TEXT | LVCF_WIDTH;
    lvc.fmt = LVCFMT_LEFT;
    lvc.pszText = szColName;

    if (LoadString(hDllInstance,
                   IDS_NAME,
                   szColName,
                   sizeof(szColName) / sizeof(szColName[0])))
    {
        lvc.cx = rcClient.right - CX_TYPECOLUMN_WIDTH -
                 GetSystemMetrics(SM_CXVSCROLL);
        (void)ListView_InsertColumn(hpd->hWndDevList,
                                    iCol++,
                                    &lvc);
    }
    if (LoadString(hDllInstance,
                   IDS_TYPE,
                   szColName,
                   sizeof(szColName) / sizeof(szColName[0])))
    {
        lvc.cx = CX_TYPECOLUMN_WIDTH;
        (void)ListView_InsertColumn(hpd->hWndDevList,
                                    iCol++,
                                    &lvc);
    }
}
Exemplo n.º 18
0
void mm_initialize_mod_list(HWND mmListview)
{
    // store this for future use
    mm_mod_list = mmListview;

    // update the style of the list view
    ListView_SetExtendedListViewStyle(mm_mod_list, LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES | LVS_EX_AUTOSIZECOLUMNS);

    // dodgy work around for column 0 always overriding the format
    LVCOLUMN lvColumn = { 0 };
    lvColumn.iSubItem = 0;
    //

    SendMessage(mm_mod_list, LVM_INSERTCOLUMN, 0, (LPARAM)&lvColumn);

    // is this enabled?
    lvColumn = { 0 };
    lvColumn.mask = LVCF_WIDTH | LVCF_SUBITEM | LVCF_FMT;
    lvColumn.cx = 20;
    lvColumn.iSubItem = MOD_LIST_COLUMN_ENABLED;
    lvColumn.fmt = LVCFMT_FIXED_WIDTH | LVCFMT_NO_TITLE | HDF_CHECKBOX;

    SendMessage(mm_mod_list, LVM_INSERTCOLUMN, MOD_LIST_COLUMN_ENABLED + 1, (LPARAM)&lvColumn);

    // what is the name of this mod?
    lvColumn = { 0 };
    lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
    lvColumn.pszText = "Name";
    lvColumn.cx = 500;
    lvColumn.fmt = LVCFMT_LEFT | LVCFMT_FIXED_WIDTH;
    lvColumn.iSubItem = MOD_LIST_COLUMN_NAME;

    SendMessage(mm_mod_list, LVM_INSERTCOLUMN, MOD_LIST_COLUMN_NAME + 1, (LPARAM)&lvColumn);

    // how big is it?
    lvColumn = { 0 };
    lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
    lvColumn.pszText = "File Size";
    lvColumn.cx = 75;
    lvColumn.fmt = LVCFMT_RIGHT | LVCFMT_FIXED_WIDTH;
    lvColumn.iSubItem = MOD_LIST_COLUMN_FILE_SIZE;

    SendMessage(mm_mod_list, LVM_INSERTCOLUMN, MOD_LIST_COLUMN_FILE_SIZE + 1, (LPARAM)&lvColumn);

    // dodgy work around for column 0 always overriding the format
    lvColumn = { 0 };
    SendMessage(mm_mod_list, LVM_DELETECOLUMN, 0, (LPARAM)&lvColumn);
    //
}
Exemplo n.º 19
0
BOOL InitDialog(HWND hWnd) {

	HWND hWndLV = GetDlgItem(hWnd, IDC_LIST);
	LV_COLUMN	lc;
	LV_ITEM		li;
	int i = 0;
	RECT rect;

	// コモンコントロール初期化
	InitCommonControls();
	ListView_SetExtendedListViewStyle(hWndLV, LVS_EX_FULLROWSELECT);

	GetClientRect(hWndLV, &rect);
	
	lc.mask = LVCF_FMT | LVCF_SUBITEM | LVCF_TEXT | LVCF_WIDTH;
	lc.fmt = LVCFMT_LEFT;
	lc.cx = rect.right / 2;

	lc.pszText = "メールアドレス (From)";
	lc.iSubItem = 0;
	lc.cchTextMax = strlen(lc.pszText);
	ListView_InsertColumn(hWndLV, 0, &lc);
	
	lc.pszText = "サウンド";
	lc.iSubItem = 1;
	lc.cchTextMax = strlen(lc.pszText);
	ListView_InsertColumn(hWndLV, 1, &lc);

	std::map<std::string, std::string>::iterator itr;
	for (itr = g_maillist.begin(); itr != g_maillist.end(); itr++) {
		li.mask = LVIF_TEXT;
		li.iItem = i;

		li.pszText = (char *)((*itr).first).c_str();
		li.iSubItem = 0;
		ListView_InsertItem(hWndLV, &li);

		li.pszText = (char *)((*itr).second).c_str();
		li.iSubItem = 1;
		ListView_SetItem(hWndLV, &li);

		i++;
	}

	EnableWindow(GetDlgItem(hWnd, IDC_MODIFY), FALSE);
	EnableWindow(GetDlgItem(hWnd, IDC_DELETE), FALSE);

	return TRUE;
}
Exemplo n.º 20
0
int LoadDataBreakpoints(HWND hwnd)
{
    int items = 0;
    int i;
    LV_ITEM item;
    RECT r;
    HWND hwndLV = GetDlgItem(hwnd, IDC_BPLIST);
    LV_COLUMN lvC;
    DATABREAK *search;
    ListView_SetExtendedListViewStyle(hwndLV, LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER);

    GetWindowRect(hwndLV, &r);
    lvC.mask = LVCF_WIDTH | LVCF_SUBITEM;
    lvC.cx = 20;
    lvC.iSubItem = 0;
    ListView_InsertColumn(hwndLV, 0, &lvC);
    lvC.mask = LVCF_WIDTH | LVCF_SUBITEM;
    lvC.cx = 32;
    lvC.iSubItem = 1;
    ListView_InsertColumn(hwndLV, 1, &lvC);
    lvC.mask = LVCF_FMT | LVCF_WIDTH | LVCF_SUBITEM;
    lvC.fmt = LVCFMT_LEFT;
    lvC.cx = r.right - r.left - 56;
    lvC.iSubItem = 2;
    ListView_InsertColumn(hwndLV, 2, &lvC);


    search = dataBpList;
    while (search)
    {
        int v;
        BOOL b = search->active;
        memset(&item, 0, sizeof(item));
        item.iItem = 10000;
        item.iSubItem = 0;
        item.mask = LVIF_PARAM;
        item.lParam = (LPARAM)search;
        v = ListView_InsertItem(hwndLV, &item);
        ListView_SetCheckState(hwndLV, v, b);
        search = search->next;
    }
    if (items)
    {
        ListView_SetSelectionMark(hwndLV, 0);
        ListView_SetItemState(hwndLV, 0, LVIS_SELECTED, LVIS_SELECTED);
    }

    return items;
}
Exemplo n.º 21
0
void ListView::init(HINSTANCE hInst, HWND parent)
{
	Window::init(hInst, parent);
    INITCOMMONCONTROLSEX icex;
    
    // Ensure that the common control DLL is loaded. 
    icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
    icex.dwICC  = ICC_LISTVIEW_CLASSES;
    InitCommonControlsEx(&icex);
    
    // Create the list-view window in report view with label editing enabled.
	int listViewStyles = LVS_REPORT | LVS_NOSORTHEADER\
						| LVS_SINGLESEL | LVS_AUTOARRANGE\
						| LVS_SHAREIMAGELISTS | LVS_SHOWSELALWAYS;

	_hSelf = ::CreateWindow(WC_LISTVIEW, 
                                TEXT(""), 
                                WS_CHILD | listViewStyles,
                                0,
                                0, 
                                0,
                                0,
                                _hParent, 
                                (HMENU) NULL, 
                                hInst,
                                NULL);
	if (!_hSelf)
	{
		throw std::runtime_error("ListView::init : CreateWindowEx() function return null");
	}

	::SetWindowLongPtr(_hSelf, GWLP_USERDATA, (LONG_PTR)this);
	_defaultProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(_hSelf, GWLP_WNDPROC, (LONG_PTR)staticProc));

	DWORD exStyle = ListView_GetExtendedListViewStyle(_hSelf);
	exStyle |= LVS_EX_FULLROWSELECT | LVS_EX_BORDERSELECT ;
	ListView_SetExtendedListViewStyle(_hSelf, exStyle);

	LVCOLUMN lvColumn;
	lvColumn.mask = LVCF_TEXT|LVCF_WIDTH;

	lvColumn.cx = 45;
	lvColumn.pszText = TEXT("Value");
	ListView_InsertColumn(_hSelf, 0, &lvColumn);

	lvColumn.cx = 70;
	lvColumn.pszText = TEXT("Character");
	ListView_InsertColumn(_hSelf, 1, &lvColumn);
}
Exemplo n.º 22
0
static void
on_create(HWND window)
{
	HWND list;

	list = CreateDlgItem(window, &DIALOG_ITEMS[DLG_LIST], DLG_LIST);
	for (int i=0; i<=COLUMN_LAST; ++i) {
		LVCOLUMN info;
		info.mask = 0;
		SendMessage(list, LVM_INSERTCOLUMN, 0, (intptr_t)&info);
	}
	ListView_SetExtendedListViewStyle(list,
	    LVS_EX_DOUBLEBUFFER | LVS_EX_SUBITEMIMAGES | LVS_EX_FULLROWSELECT);
	IconList_enable_for_listview(list);
}
BOOL AP_Win32Dialog_CollaborationAccounts::_onInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
	// Set up common controls
	INITCOMMONCONTROLSEX icc;
	icc.dwSize=sizeof(INITCOMMONCONTROLSEX);
	icc.dwICC=ICC_LISTVIEW_CLASSES;

	m_hAccountList = GetDlgItem(hWnd, AP_RID_DIALOG_COLLABORATIONACCOUNTS_ACCOUNT_LIST);

	// setup our listview columns

	// column 0
	LVCOLUMNW lvc;
	lvc.mask = LVCF_WIDTH | LVCF_TEXT; 
    lvc.pszText = L"Online";	
	lvc.cx = 50;
	ListView_InsertColumn(m_hAccountList, 0, &lvc);

	// column 1
	lvc.mask = LVCF_WIDTH | LVCF_TEXT; 
    lvc.pszText = L"Account";	
	lvc.cx = 180;
	ListView_InsertColumn(m_hAccountList, 1, &lvc);

	// column 2
	lvc.mask = LVCF_WIDTH | LVCF_TEXT; 
    lvc.pszText = L"Type";
	lvc.cx = 200;
	ListView_InsertColumn(m_hAccountList, 2, &lvc);

	// enable checkboxes and row select on items in the list view
	ListView_SetExtendedListViewStyle(m_hAccountList, LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT);

	// Get ourselves a custom DialogHelper
	DELETEP(m_pWin32Dialog);
	m_pWin32Dialog = new XAP_Win32DialogHelper(hWnd);
	
	// Set up dialog initial state
	_populateWindowData();
	
	// we have no selection yet
	//_updateSelection();
	
	// Center Window
	m_pWin32Dialog->centerDialog();

	return true;
}
Exemplo n.º 24
0
void CEffectDlg::PresetOnInitDialog(HWND hwndDlg)
{
	TCHAR szPath[MAX_PATH];
	TCHAR sz[MAX_PATH];
	WIN32_FIND_DATA wfd;

	HWND hwndLV = GetDlgItem(hwndDlg, IDC_LIST_PRESET);

	RECT rc;
	GetClientRect(hwndLV, &rc);
	ListView_SetExtendedListViewStyle(hwndLV, 
		ListView_GetExtendedListViewStyle(hwndLV) | LVS_EX_FULLROWSELECT);
	LVCOLUMN lvc;
	lvc.mask = LVCF_FMT | LVCF_SUBITEM | LVCF_TEXT | LVCF_WIDTH;
	lvc.fmt = LVCFMT_LEFT;
	lvc.cx = RECT_WIDTH(&rc) - GetSystemMetrics(SM_CXVSCROLL) - 2;
	lvc.pszText = _T("Name");
	lvc.iSubItem = 0;
	ListView_InsertColumn(hwndLV, 0, &lvc);

	SendMessage(hwndLV, WM_SETFONT, SendMessage(hwndDlg, WM_GETFONT, 0, 0), 0);

	if (!GetPresetDir(szPath))
		return;
	
	if (_tcslen(szPath) + _tcslen(EFFECT_FILE_EXT) + 4 > MAX_PATH)
		return;

	wsprintf(sz, _T("%s\\*.%s"), szPath, EFFECT_FILE_EXT);
	HANDLE hFind = FindFirstFile(sz, &wfd);
	if (hFind != INVALID_HANDLE_VALUE) {
		do {
			LPTSTR p = _tcsrchr(wfd.cFileName, _T('.'));
			if (p) *p = NULL;
			
			LVITEM li;
			memset(&li, 0, sizeof(LVITEM));
			li.mask = LVIF_TEXT;
			li.iItem = ListView_GetItemCount(hwndLV);
			li.pszText = wfd.cFileName;
			ListView_InsertItem(hwndLV, &li);
		}
		while (FindNextFile(hFind, &wfd));
		FindClose(hFind);
	}

	EnableWindow(GetDlgItem(hwndDlg, IDC_DEL), FALSE);
}
Exemplo n.º 25
0
void init_list_box(HWND Box, const char* Strs[], int numColumns, int *columnWidths) //initializes the ram search and/or ram watch listbox
{
	LVCOLUMN Col;
	Col.mask = LVCF_FMT | LVCF_ORDER | LVCF_SUBITEM | LVCF_TEXT | LVCF_WIDTH;
	Col.fmt = LVCFMT_CENTER;
	for (int i = 0; i < numColumns; i++)
	{
		Col.iOrder = i;
		Col.iSubItem = i;
		Col.pszText = (LPSTR)(Strs[i]);
		Col.cx = columnWidths[i];
		ListView_InsertColumn(Box,i,&Col);
	}

	ListView_SetExtendedListViewStyle(Box, LVS_EX_FULLROWSELECT);
}
Exemplo n.º 26
0
void ShortcutMapper::initList()
{
	int i;
	LV_COLUMN col={0};
	TCHAR *col_names[3]={L"Index",L"Name",L"Shortcut"};
	hlistview=GetDlgItem(_hSelf,IDC_SHORTCUT_LIST);
	for(i=0;i<sizeof(col_names)/sizeof(TCHAR *);i++){
		col.mask=LVCF_FMT|LVCF_TEXT|LVCF_WIDTH;
		col.fmt=LVCFMT_LEFT;
		col.cx=gettextwidth(hlistview,col_names[i]);
		col.pszText=col_names[i];
		ListView_InsertColumn(hlistview,i,&col);
	}
	ListView_SetExtendedListViewStyle(hlistview,
		ListView_GetExtendedListViewStyle(hlistview)|LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES);
}
Exemplo n.º 27
0
/// <summary>
/// Constructor
/// </summary>
CustomDrawListControl::CustomDrawListControl(HWND hWnd, int columns)
    : m_hWnd(hWnd)
    , m_nColumns(columns)
{
    EnsureFontCreated(DefaultFont, 15, FW_NORMAL);

    // Set list control style
    ListView_SetExtendedListViewStyle(m_hWnd, LVS_EX_FULLROWSELECT);

    // Insert columns
    for (int i = 0; i < m_nColumns; ++i)
    {
        LVCOLUMN lvc = {0};
        ListView_InsertColumn(m_hWnd, i, (LPARAM)&lvc);
    }
}
Exemplo n.º 28
0
bool VDUIListViewW32::Create(IVDUIParameters *pParameters) {
	mbCheckable = pParameters->GetB(nsVDUI::kUIParam_Checkable, false);

	DWORD dwFlags = LVS_REPORT | WS_TABSTOP;

	if (pParameters->GetB(nsVDUI::kUIParam_NoHeader, false))
		dwFlags |= LVS_NOCOLUMNHEADER;

	if (!CreateW32(pParameters, WC_LISTVIEW, dwFlags))
		return false;

	ListView_SetExtendedListViewStyle(mhwnd, LVS_EX_FULLROWSELECT | ListView_GetExtendedListViewStyle(mhwnd));

	if (mbCheckable) {
		const int cx = GetSystemMetrics(SM_CXMENUCHECK);
		const int cy = GetSystemMetrics(SM_CYMENUCHECK);

		if (HBITMAP hbm = CreateBitmap(cx, cy, 1, 1, NULL)) {
			if (HDC hdc = CreateCompatibleDC(NULL)) {
				if (HGDIOBJ hbmOld = SelectObject(hdc, hbm)) {
					bool success = false;

					RECT r = { 0, 0, cx, cy };

					SetBkColor(hdc, PALETTEINDEX(0));
					ExtTextOut(hdc, 0, 0, ETO_OPAQUE, &r, "", 0, NULL);
					DrawFrameControl(hdc, &r, DFC_BUTTON, DFCS_BUTTONCHECK|DFCS_CHECKED);

					SelectObject(hdc, hbmOld);

					if (HIMAGELIST himl = ImageList_Create(cx, cy, ILC_COLOR, 1, 1)) {
						if (ImageList_Add(himl, hbm, NULL) >= 0)
							ListView_SetImageList(mhwnd, himl, LVSIL_STATE);
						else
							ImageList_Destroy(himl);
					}
				}

				DeleteDC(hdc);
			}

			DeleteObject(hbm);
		}
	}

	return true;
}
Exemplo n.º 29
0
//*******************************************************************************
//  if VListView class is used, this function is incorporated within the class
//*******************************************************************************
void CVListView::lview_assign_column_headers(void)
{
   DWORD styles = 0 ;
   if (style_flags & LVL_STY_EX_GRIDLINES) {
      styles |= LVS_EX_GRIDLINES ;
   }
   if (style_flags & LVL_STY_EX_FULL_ROW) {
      /// styles |= (LVS_EX_FULLROWSELECT | LVS_SHOWSELALWAYS) ;
      styles |= LVS_EX_FULLROWSELECT ;
   }
   
   // LVS_EX_INFOTIP enables tooltips
   // LVS_EX_LABELTIP ensures the full tooltip is shown and is not partially hidden
   if (style_flags & LVL_STY_EX_TOOLTIPS) {
      styles |= (LVS_EX_INFOTIP | LVS_EX_LABELTIP) ;
   }
   if (styles != 0)
      ListView_SetExtendedListViewStyle(hwndVListView, styles) ;   //lint !e522

   //  set extended styles
   // ListView_SetExtendedListViewStyle(tiSelf->hwndRxData, LVS_EX_ONECLICKACTIVATE) ;

   // initialize the column
   //  Even though we've disabled column headers with LVS_NOCOLUMNHEADER,
   //  we *still* need to insert the column.
   //  Mind you, this should *only* be done ONCE...
   LVCOLUMN LvColumn;                 // Make Column struct for ListView
   memset (&LvColumn, 0, sizeof (LvColumn)); // Reset Column
   
   LvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
   LvColumn.fmt = LVCFMT_LEFT;
   //  shorten column by width of the vertical scroll bar,
   //  so we don't get a horizontal scroll bar once the 
   //  vertical scroll bar gets drawn.
   // syslog("vertical scroll-bar width=%u pixels\n", iOffset) ;
   uint iOffset = GetSystemMetrics (SM_CXVSCROLL);
   iOffset += 6 ;
   LvColumn.cx = cxClient - iOffset ;
   // LvColumn.pszText = "comm-port terminal" ;
#ifdef UNICODE            
   LvColumn.pszText = ascii2unicode(".") ;
#else
   LvColumn.pszText = "." ;   //lint !e1778  asmt is not const safe
#endif
   SendMessage(hwndVListView, LVM_INSERTCOLUMN, 0, (LPARAM)(const LV_COLUMN*)(&LvColumn)) ;
}
Exemplo n.º 30
0
static void SetListViewColumns(HWND hwndParent, HWND hwnd)
{
    RECT r;
    LV_COLUMN lvC;
    ListView_SetExtendedListViewStyle(hwnd, LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT);

    GetClientRect(hwnd, &r);
    lvC.mask = LVCF_WIDTH | LVCF_SUBITEM  | LVCF_TEXT;
    lvC.cx = 180;
    lvC.iSubItem = 0;
    lvC.pszText = "Id";
    ListView_InsertColumn(hwnd, 0, &lvC);
    lvC.mask = LVCF_WIDTH | LVCF_SUBITEM  | LVCF_TEXT;
    lvC.cx = r.right - 180;
    lvC.iSubItem = 1;
    lvC.pszText = "String";
    ListView_InsertColumn(hwnd, 1, &lvC);
}