Exemplo n.º 1
0
/*
* MainWindowHandleObjectTreeProp
*
* Purpose:
*
* Object Tree properties per selected item.
*
*/
VOID MainWindowHandleObjectTreeProp(
    _In_ HWND hwnd
)
{
    TV_ITEM tvi;
    WCHAR   szBuffer[MAX_PATH + 1];

    if (g_PropWindow != NULL)
        return;

    if (SelectedTreeItem == NULL)
        return;

    szBuffer[0] = 0; //mars workaround

    RtlSecureZeroMemory(szBuffer, sizeof(szBuffer));
    RtlSecureZeroMemory(&tvi, sizeof(TV_ITEM));

    tvi.pszText = szBuffer;
    tvi.cchTextMax = MAX_PATH;
    tvi.mask = TVIF_TEXT;
    tvi.hItem = SelectedTreeItem;
    if (TreeView_GetItem(g_hwndObjectTree, &tvi)) {
        propCreateDialog(hwnd, szBuffer, g_lpObjectNames[TYPE_DIRECTORY], NULL);
    }
}
Exemplo n.º 2
0
/*
* MainWindowHandleObjectListProp
*
* Purpose:
*
* Object List properties per selected item.
*
*/
VOID MainWindowHandleObjectListProp(
    _In_ HWND hwnd
)
{
    INT     nSelected;
    LPWSTR  lpItemText, lpType, lpDesc = NULL;

    if (g_PropWindow != NULL)
        return;

    //nothing selected, go away
    if (ListView_GetSelectedCount(g_hwndObjectList) == 0) {
        return;
    }

    nSelected = ListView_GetSelectionMark(g_hwndObjectList);
    if (nSelected == -1) {
        return;
    }

    lpItemText = supGetItemText(g_hwndObjectList, nSelected, 0, NULL);
    if (lpItemText) {
        lpType = supGetItemText(g_hwndObjectList, nSelected, 1, NULL);
        if (lpType) {

            //lpDesc is not important, we can work if it NULL
            lpDesc = supGetItemText(g_hwndObjectList, nSelected, 2, NULL);

            propCreateDialog(hwnd, lpItemText, lpType, lpDesc);

            if (lpDesc) {
                supHeapFree(lpDesc);
            }
            supHeapFree(lpType);
        }
        supHeapFree(lpItemText);
    }
}
Exemplo n.º 3
0
/*
* DesktopListHandleNotify
*
* Purpose:
*
* WM_NOTIFY processing for Desktop page listview.
*
*/
VOID DesktopListHandleNotify(
	HWND			hwndDlg,
	LPNMLISTVIEW	nhdr
	)
{
	LVCOLUMNW	col;
	INT			c;
	SIZE_T		sz, i, l;
	LPWSTR		lpItemText, lpName;

	if (nhdr == NULL) {
		return;
	}

	if (nhdr->hdr.idFrom != ID_DESKTOPSLIST) {
		return;
	}

	switch (nhdr->hdr.code) {

	case LVN_COLUMNCLICK:
		bDesktopListSortInverse = !bDesktopListSortInverse;
		DesktopListSortColumn = ((NMLISTVIEW *)nhdr)->iSubItem;
		ListView_SortItemsEx(DesktopList, &DesktopListCompareFunc, DesktopListSortColumn);

		RtlSecureZeroMemory(&col, sizeof(col));
		col.mask = LVCF_IMAGE;
		col.iImage = -1;

		for (c = 0; c < 3; c++) {
			ListView_SetColumn(DesktopList, c, &col);
		}

		if (bDesktopListSortInverse)
			col.iImage = 1;
		else
			col.iImage = 2;

		ListView_SetColumn(DesktopList, ((NMLISTVIEW *)nhdr)->iSubItem, &col);
		break;

	case NM_DBLCLK:
		/*
		* A very basic support for this type
		* desktop described by win32k PDESKTOP structure which is totally undocumented
		*/
		sz = 0;
		lpItemText = supGetItemText(DesktopList, ListView_GetSelectionMark(DesktopList), 0, &sz);
		if (lpItemText) {
			l = 0;
			for (i = 0; i<sz; i++)
				if (lpItemText[i] == L'\\')
					l = i + 1;
			lpName = &lpItemText[l];
			//hwndDlg set to mainwindow on purpose
			propCreateDialog(hwndDlg, lpName, T_ObjectNames[TYPE_DESKTOP], NULL);
			HeapFree(GetProcessHeap(), 0, lpItemText);
		}
		break;

	default:
		break;
	}
}