mirror of
https://github.com/reactos/reactos.git
synced 2024-12-25 16:50:57 +00:00
Updated treeview and listview functionality.
svn path=/trunk/; revision=3241
This commit is contained in:
parent
74571d0428
commit
1ad1b97103
6 changed files with 251 additions and 443 deletions
|
@ -43,18 +43,6 @@
|
|||
#include "treeview.h"
|
||||
#include "listview.h"
|
||||
|
||||
//HWND hLeftWnd; // Tree Control Window
|
||||
//HWND hRightWnd; // List Control Window
|
||||
|
||||
#define hLeftWnd hTreeWnd
|
||||
#define hRightWnd hListWnd
|
||||
|
||||
|
||||
//HWND hTreeWnd; // Tree Control Window
|
||||
//HWND hListWnd; // List Control Window
|
||||
|
||||
//static int nSplitPos = 250;
|
||||
//static int nFocusPanel;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -146,28 +134,9 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||
|
||||
switch (message) {
|
||||
case WM_CREATE:
|
||||
//HWND CreateListView(HWND hwndParent/*, Pane* pane*/, int id, LPTSTR lpszPathName);
|
||||
/*
|
||||
typedef struct tagCREATESTRUCT {
|
||||
LPVOID lpCreateParams;
|
||||
HINSTANCE hInstance;
|
||||
HMENU hMenu;
|
||||
HWND hwndParent;
|
||||
int cy;
|
||||
int cx;
|
||||
int y;
|
||||
int x;
|
||||
LONG style;
|
||||
LPCTSTR lpszName;
|
||||
LPCTSTR lpszClass;
|
||||
DWORD dwExStyle;
|
||||
} CREATESTRUCT, *LPCREATESTRUCT;
|
||||
*/
|
||||
pChildWnd = (ChildWnd*)((LPCREATESTRUCT)lParam)->lpCreateParams;
|
||||
ASSERT(pChildWnd);
|
||||
|
||||
pChildWnd->nSplitPos = 250;
|
||||
|
||||
pChildWnd->hTreeWnd = CreateTreeView(hWnd, TREE_WINDOW, &pChildWnd->root);
|
||||
pChildWnd->hListWnd = CreateListView(hWnd, LIST_WINDOW, &pChildWnd->root);
|
||||
break;
|
||||
|
@ -269,9 +238,9 @@ typedef struct tagCREATESTRUCT {
|
|||
rt.left = x-SPLIT_WIDTH/2;
|
||||
rt.right = x+SPLIT_WIDTH/2+1;
|
||||
InvalidateRect(hWnd, &rt, FALSE);
|
||||
UpdateWindow(hLeftWnd);
|
||||
UpdateWindow(hTreeWnd);
|
||||
UpdateWindow(hWnd);
|
||||
UpdateWindow(hRightWnd);
|
||||
UpdateWindow(hListWnd);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -289,7 +258,7 @@ typedef struct tagCREATESTRUCT {
|
|||
case WM_SETFOCUS:
|
||||
// SetCurrentDirectory(szPath);
|
||||
if (pChildWnd != NULL) {
|
||||
SetFocus(pChildWnd->nFocusPanel? pChildWnd->hRightWnd: pChildWnd->hLeftWnd);
|
||||
SetFocus(pChildWnd->nFocusPanel? pChildWnd->hListWnd: pChildWnd->hTreeWnd);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -301,9 +270,13 @@ typedef struct tagCREATESTRUCT {
|
|||
if ((((LPNMHDR)lParam)->code) == TVN_SELCHANGED) {
|
||||
Entry* entry = (Entry*)((NMTREEVIEW*)lParam)->itemNew.lParam;
|
||||
if (entry != NULL) {
|
||||
//RefreshList(pChildWnd->right.hWnd, entry);
|
||||
//void set_curdir(ChildWnd* child, Entry* entry)
|
||||
//set_curdir(pChildWnd, entry);
|
||||
if (!entry->scanned) {
|
||||
//scan_entry(pChildWnd, entry);
|
||||
} else {
|
||||
//RefreshList(pChildWnd->hListWnd, entry);
|
||||
}
|
||||
//RefreshList(pChildWnd->hListWnd, entry->down);
|
||||
RefreshList(pChildWnd->hListWnd, entry);
|
||||
}
|
||||
}
|
||||
if (!SendMessage(pChildWnd->hTreeWnd, message, wParam, lParam)) {
|
||||
|
|
|
@ -40,6 +40,8 @@
|
|||
#include "main.h"
|
||||
#include "listview.h"
|
||||
|
||||
#include "trace.h"
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Global Variables:
|
||||
|
@ -52,7 +54,48 @@ static WNDPROC g_orgListWndProc;
|
|||
// Local module support methods
|
||||
//
|
||||
|
||||
static void AddEntryToList(HWND hwndLV, int idx, Entry* entry)
|
||||
{
|
||||
LVITEM item;
|
||||
|
||||
item.mask = LVIF_TEXT | LVIF_PARAM;
|
||||
item.iItem = 0;//idx;
|
||||
item.iSubItem = 0;
|
||||
item.state = 0;
|
||||
item.stateMask = 0;
|
||||
// item.pszText = entry->data.cFileName;
|
||||
item.pszText = LPSTR_TEXTCALLBACK;
|
||||
// item.cchTextMax = strlen(entry->data.cFileName);
|
||||
item.cchTextMax = 0;
|
||||
item.iImage = 0;
|
||||
// item.iImage = I_IMAGECALLBACK;
|
||||
item.lParam = (LPARAM)entry;
|
||||
#if (_WIN32_IE >= 0x0300)
|
||||
item.iIndent = 0;
|
||||
#endif
|
||||
ListView_InsertItem(hwndLV, &item);
|
||||
}
|
||||
|
||||
// insert listctrl entries after index idx
|
||||
static void InsertListEntries(HWND hWnd, Entry* entry, int idx)
|
||||
{
|
||||
ShowWindow(hWnd, SW_HIDE);
|
||||
|
||||
if (idx == -1) {
|
||||
}
|
||||
idx = 0;
|
||||
|
||||
for (; entry; entry = entry->next) {
|
||||
#ifndef _LEFT_FILES
|
||||
// if (entry->data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||
// continue;
|
||||
#endif
|
||||
//ListBox_InsertItemData(hWnd, idx, entry);
|
||||
AddEntryToList(hWnd, idx, entry);
|
||||
++idx;
|
||||
}
|
||||
ShowWindow(hWnd, SW_SHOW);
|
||||
}
|
||||
|
||||
#define MAX_LIST_COLUMNS (IDS_LIST_COLUMN_LAST - IDS_LIST_COLUMN_FIRST + 1)
|
||||
static int default_column_widths[MAX_LIST_COLUMNS] = { 200, 175, 400 };
|
||||
|
@ -88,25 +131,61 @@ static void CreateListColumns(HWND hWndListView)
|
|||
static void OnGetDispInfo(NMLVDISPINFO* plvdi)
|
||||
{
|
||||
static TCHAR buffer[200];
|
||||
// Entry* entry = (Entry*)plvdi->item.lParam;
|
||||
// ASSERT(entry);
|
||||
|
||||
// FILETIME LastWriteTime;
|
||||
// TCHAR Class[MAX_NAME_LEN];
|
||||
// DWORD cClass = MAX_NAME_LEN;
|
||||
// TCHAR Name[MAX_NAME_LEN];
|
||||
// DWORD cName = MAX_NAME_LEN;
|
||||
// DWORD dwIndex = 0L;
|
||||
|
||||
Entry* pEntry = (Entry*)plvdi->item.lParam;
|
||||
ASSERT(pEntry);
|
||||
|
||||
plvdi->item.pszText = NULL;
|
||||
plvdi->item.cchTextMax = 0;
|
||||
|
||||
switch (plvdi->item.iSubItem) {
|
||||
case 0:
|
||||
// plvdi->item.pszText = entry->data.cFileName;
|
||||
/*
|
||||
plvdi->item.pszText = _T("(Default)");
|
||||
plvdi->item.cchTextMax = _tcslen(plvdi->item.pszText);
|
||||
if (pEntry->bKey == TRUE) {
|
||||
DWORD nSubKeys;
|
||||
DWORD MaxSubKeyLen;
|
||||
DWORD MaxClassLen;
|
||||
DWORD ValueCount;
|
||||
DWORD MaxValueNameLen;
|
||||
DWORD MaxValueLen;
|
||||
DWORD SecurityDescriptorLen;
|
||||
|
||||
HKEY hKey = pEntry->hKey;
|
||||
LONG result = RegQueryInfoKey(pEntry->hKey, Class, &cClass, 0,
|
||||
&nSubKeys, &MaxSubKeyLen, &MaxClassLen, &ValueCount,
|
||||
&MaxValueNameLen, &MaxValueLen, &SecurityDescriptorLen,
|
||||
&LastWriteTime);
|
||||
if (result == ERROR_SUCCESS) {
|
||||
plvdi->item.pszText = Class;
|
||||
plvdi->item.cchTextMax = cClass;
|
||||
}
|
||||
}
|
||||
*/
|
||||
plvdi->item.pszText = pEntry->szName;
|
||||
plvdi->item.cchTextMax = lstrlen(pEntry->szName);
|
||||
|
||||
break;
|
||||
case 1:
|
||||
plvdi->item.pszText = _T("REG_SZ");
|
||||
break;
|
||||
case 2:
|
||||
plvdi->item.pszText = _T("(value not set)");
|
||||
break;
|
||||
case 3:
|
||||
break;
|
||||
case 4:
|
||||
plvdi->item.pszText = _T("");
|
||||
break;
|
||||
default:
|
||||
_tcscpy(buffer, _T(" "));
|
||||
plvdi->item.pszText = buffer;
|
||||
// _tcscpy(buffer, _T(" "));
|
||||
// plvdi->item.pszText = buffer;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -121,6 +200,9 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
return TRUE;
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void ListViewPopUpMenu(HWND hWnd, POINT pt)
|
||||
{
|
||||
}
|
||||
|
||||
static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
|
@ -178,19 +260,36 @@ static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
|
|||
}
|
||||
break;
|
||||
|
||||
case NM_RCLICK:
|
||||
{
|
||||
int idx;
|
||||
LV_HITTESTINFO lvH;
|
||||
NM_LISTVIEW *pNm = (NM_LISTVIEW *)lParam;
|
||||
lvH.pt.x = pNm->ptAction.x;
|
||||
lvH.pt.y = pNm->ptAction.y;
|
||||
idx = ListView_HitTest(hWnd, &lvH);
|
||||
if (idx != -1) {
|
||||
POINT pt;
|
||||
GetCursorPos(&pt);
|
||||
ListViewPopUpMenu(hWnd, pt);
|
||||
return idx;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return CallWindowProc(g_orgListWndProc, hWnd, message, wParam, lParam);
|
||||
}
|
||||
break;
|
||||
case WM_KEYDOWN:
|
||||
if (wParam == VK_TAB) {
|
||||
//TODO: SetFocus(Globals.hDriveBar)
|
||||
//SetFocus(child->nFocusPanel? child->left.hWnd: child->right.hWnd);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return CallWindowProc(g_orgListWndProc, hWnd, message, wParam, lParam);
|
||||
break;
|
||||
case WM_KEYDOWN:
|
||||
if (wParam == VK_TAB) {
|
||||
//TODO: SetFocus(Globals.hDriveBar)
|
||||
//SetFocus(child->nFocusPanel? child->left.hWnd: child->right.hWnd);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return CallWindowProc(g_orgListWndProc, hWnd, message, wParam, lParam);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -237,12 +336,10 @@ void RefreshList(HWND hWnd, Entry* entry)
|
|||
{
|
||||
if (hWnd != NULL) {
|
||||
ListView_DeleteAllItems(hWnd);
|
||||
/*
|
||||
if (entry != NULL) {
|
||||
TRACE("RefreshList(...) entry name: %s\n", entry->data.cFileName);
|
||||
TRACE("RefreshList(...) entry name: %p\n", entry);
|
||||
InsertListEntries(hWnd, entry, -1);
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
|
|||
hInst = hInstance; // Store instance handle in our global variable
|
||||
// hFrameWnd = CreateWindow(szFrameClass, szTitle, WS_OVERLAPPEDWINDOW,
|
||||
// CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
|
||||
hFrameWnd = CreateWindowEx(0, (LPCTSTR)(int)hFrameWndClass, _T("regedit application"),
|
||||
hFrameWnd = CreateWindowEx(0, (LPCTSTR)(int)hFrameWndClass, szTitle,
|
||||
WS_OVERLAPPEDWINDOW,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
|
||||
NULL, hMenuFrame, hInstance, NULL/*lpParam*/);
|
||||
|
|
|
@ -35,6 +35,16 @@ extern "C" {
|
|||
#include "regproc.h"
|
||||
|
||||
|
||||
#define STATUS_WINDOW 2001
|
||||
#define TREE_WINDOW 2002
|
||||
#define LIST_WINDOW 2003
|
||||
#define SPLIT_WINDOW 2004
|
||||
|
||||
#define MAX_LOADSTRING 100
|
||||
#define SPLIT_WIDTH 3
|
||||
#define MAX_NAME_LEN 500
|
||||
|
||||
|
||||
typedef struct _Entry {
|
||||
struct _Entry* next;
|
||||
struct _Entry* down;
|
||||
|
@ -46,6 +56,7 @@ typedef struct _Entry {
|
|||
HKEY hKey;
|
||||
// BOOL bRoot;
|
||||
HTREEITEM hTreeItem;
|
||||
TCHAR szName[MAX_NAME_LEN];
|
||||
} Entry;
|
||||
|
||||
|
||||
|
@ -66,14 +77,6 @@ typedef struct {
|
|||
} ChildWnd;
|
||||
|
||||
|
||||
#define STATUS_WINDOW 2001
|
||||
#define TREE_WINDOW 2002
|
||||
#define LIST_WINDOW 2003
|
||||
#define SPLIT_WINDOW 2004
|
||||
|
||||
#define MAX_LOADSTRING 100
|
||||
#define SPLIT_WIDTH 3
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Global Variables:
|
||||
//
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
//Microsoft Developer Studio generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -33,10 +34,14 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
|||
IDI_REGEDIT ICON DISCARDABLE "res/regedit.ico"
|
||||
IDI_SMALL ICON DISCARDABLE "res/small.ico"
|
||||
|
||||
IDB_OPEN_FILE BITMAP DISCARDABLE "res/folder1.bmp"
|
||||
IDB_CLOSED_FILE BITMAP DISCARDABLE "res/folder2.bmp"
|
||||
IDB_ROOT BITMAP DISCARDABLE "res/folder3.bmp"
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Bitmap
|
||||
//
|
||||
|
||||
IDB_OPEN_FILE BITMAP DISCARDABLE "res/folder1.bmp"
|
||||
IDB_CLOSED_FILE BITMAP DISCARDABLE "res/folder2.bmp"
|
||||
IDB_ROOT BITMAP DISCARDABLE "res/folder3.bmp"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
@ -59,16 +64,17 @@ IDR_REGEDIT_MENU MENU DISCARDABLE
|
|||
BEGIN
|
||||
POPUP "&Registry"
|
||||
BEGIN
|
||||
MENUITEM "&Import Registry File...", ID_REGISTRY_IMPORTREGISTRYFILE, GRAYED
|
||||
|
||||
MENUITEM "&Export Registry File...", ID_REGISTRY_EXPORTREGISTRYFILE, GRAYED
|
||||
|
||||
MENUITEM "&Import Registry File...", ID_REGISTRY_IMPORTREGISTRYFILE
|
||||
, GRAYED
|
||||
MENUITEM "&Export Registry File...", ID_REGISTRY_EXPORTREGISTRYFILE
|
||||
, GRAYED
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Connect Network Registry...",
|
||||
ID_REGISTRY_CONNECTNETWORKREGISTRY, GRAYED
|
||||
|
||||
ID_REGISTRY_CONNECTNETWORKREGISTRY
|
||||
, GRAYED
|
||||
MENUITEM "&Disconnect Network Registry...",
|
||||
ID_REGISTRY_DISCONNECTNETWORKREGISTRY, GRAYED
|
||||
ID_REGISTRY_DISCONNECTNETWORKREGISTRY
|
||||
, GRAYED
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Print\tCtrl+P", ID_REGISTRY_PRINT, GRAYED
|
||||
MENUITEM SEPARATOR
|
||||
|
@ -105,7 +111,8 @@ BEGIN
|
|||
END
|
||||
POPUP "&Favourites"
|
||||
BEGIN
|
||||
MENUITEM "&Add to Favourites", ID_FAVOURITES_ADDTOFAVOURITES, GRAYED
|
||||
MENUITEM "&Add to Favourites", ID_FAVOURITES_ADDTOFAVOURITES
|
||||
, GRAYED
|
||||
MENUITEM "&Remove Favourite", ID_FAVOURITES_REMOVEFAVOURITE
|
||||
, GRAYED
|
||||
END
|
||||
|
@ -117,13 +124,6 @@ BEGIN
|
|||
END
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_LIST_COLUMN_NAME "Name"
|
||||
IDS_LIST_COLUMN_TYPE "Type"
|
||||
IDS_LIST_COLUMN_DATA "Data"
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
@ -174,46 +174,60 @@ END
|
|||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_APP_TITLE "ReactOS Registry Editor"
|
||||
IDS_LIST_COLUMN_NAME "Name"
|
||||
IDS_LIST_COLUMN_TYPE "Type"
|
||||
IDS_LIST_COLUMN_DATA "Data"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_APP_TITLE "ReactOS Registry Editor"
|
||||
IDC_REGEDIT "REGEDIT"
|
||||
IDC_REGEDIT_FRAME "REGEDIT_FRAME"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
ID_REGISTRY_MENU "Contains commands for working with the whole registry"
|
||||
ID_EDIT_MENU "Contains commands for editing values or keys"
|
||||
ID_EDIT_NEW_MENU "Contains commands for creating new keys or values"
|
||||
ID_VIEW_MENU "Contains commands for customising the registry window"
|
||||
ID_FAVOURITES_MENU "Contains commands for accessing frequently used keys"
|
||||
ID_HELP_MENU "Contains commands for displaying help and information about registry editor"
|
||||
ID_EDIT_NEW_MENU "Contains commands for creating new keys or values"
|
||||
END
|
||||
|
||||
ID_REGISTRY_IMPORTREGISTRYFILE "Imports a text file into the registry"
|
||||
ID_REGISTRY_EXPORTREGISTRYFILE "Exports all or part of the registry to a text file"
|
||||
ID_REGISTRY_CONNECTNETWORKREGISTRY "Connects to a remote computer's registry"
|
||||
ID_REGISTRY_DISCONNECTNETWORKREGISTRY "Disconnects from a remote computer's registry"
|
||||
ID_REGISTRY_PRINT "Prints all or part of the registry"
|
||||
ID_REGISTRY_EXIT "Quits the registry editor"
|
||||
|
||||
ID_EDIT_MODIFY "Modifies the value's data"
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
ID_EDIT_MODIFY "Modifies the value's data"
|
||||
ID_EDIT_NEW_KEY "Adds a new key"
|
||||
ID_EDIT_NEW_STRINGVALUE "Adds a new string value"
|
||||
ID_EDIT_NEW_BINARYVALUE "Adds a new binary value"
|
||||
ID_EDIT_NEW_DWORDVALUE "Adds a new double word value"
|
||||
ID_REGISTRY_IMPORTREGISTRYFILE "Imports a text file into the registry"
|
||||
ID_REGISTRY_EXPORTREGISTRYFILE
|
||||
"Exports all or part of the registry to a text file"
|
||||
ID_REGISTRY_CONNECTNETWORKREGISTRY
|
||||
"Connects to a remote computer's registry"
|
||||
ID_REGISTRY_DISCONNECTNETWORKREGISTRY
|
||||
"Disconnects from a remote computer's registry"
|
||||
ID_REGISTRY_PRINT "Prints all or part of the registry"
|
||||
ID_HELP_ABOUT "Displays program information, version number and copyright"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
ID_REGISTRY_EXIT "Quits the registry editor"
|
||||
ID_HELP_HELPTOPICS "Opens registry editor help"
|
||||
ID_FAVOURITES_ADDTOFAVOURITES "Adds keys to the favourites list"
|
||||
ID_FAVOURITES_REMOVEFAVOURITE "Removes keys from the favourites list"
|
||||
ID_VIEW_STATUSBAR "Shows or hides the status bar"
|
||||
ID_VIEW_SPLIT "Change position of split between two panes"
|
||||
ID_VIEW_REFRESH "Refreshes the window"
|
||||
ID_EDIT_DELETE "Deletes the selection"
|
||||
ID_EDIT_RENAME "Renames the selection"
|
||||
ID_EDIT_COPYKEYNAME "Copies the name of the selected key to the clipboard"
|
||||
ID_EDIT_FIND "Finds a text string in a key, value or data"
|
||||
ID_EDIT_FINDNEXT "Finds next occurrence of text specified in previous search"
|
||||
|
||||
ID_VIEW_STATUSBAR "Shows or hides the status bar"
|
||||
ID_VIEW_SPLIT "Change position of split between two panes"
|
||||
ID_VIEW_REFRESH "Refreshes the window"
|
||||
|
||||
ID_FAVOURITES_ADDTOFAVOURITES "Adds keys to the favourites list"
|
||||
ID_FAVOURITES_REMOVEFAVOURITE "Removes keys from the favourites list"
|
||||
|
||||
ID_HELP_HELPTOPICS "Opens registry editor help"
|
||||
ID_HELP_ABOUT "Displays program information, version number and copyright"
|
||||
|
||||
IDC_REGEDIT "REGEDIT"
|
||||
IDC_REGEDIT_FRAME "REGEDIT_FRAME"
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
|
|
|
@ -57,93 +57,6 @@ int Image_Root;
|
|||
#define NUM_BITMAPS 3
|
||||
|
||||
|
||||
#if 0
|
||||
/*
|
||||
// AddItemToTree - adds items to a tree view control.
|
||||
// Returns the handle to the newly added item.
|
||||
// hwndTV - handle to the tree view control.
|
||||
// lpszItem - text of the item to add.
|
||||
// nLevel - level at which to add the item.
|
||||
|
||||
HTREEITEM AddItemToTree(HWND hwndTV, LPTSTR lpszItem, int nLevel)
|
||||
{
|
||||
TVITEM tvi;
|
||||
TVINSERTSTRUCT tvins;
|
||||
static HTREEITEM hPrev = (HTREEITEM)TVI_FIRST;
|
||||
static HTREEITEM hPrevRootItem = NULL;
|
||||
static HTREEITEM hPrevLev2Item = NULL;
|
||||
HTREEITEM hti;
|
||||
|
||||
tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_CHILDREN | TVIF_PARAM;
|
||||
|
||||
// Set the text of the item.
|
||||
tvi.pszText = lpszItem;
|
||||
tvi.cchTextMax = lstrlen(lpszItem);
|
||||
|
||||
// Assume the item is not a parent item, so give it an image.
|
||||
tvi.iImage = Image_Root;
|
||||
tvi.iSelectedImage = Image_Root;
|
||||
|
||||
tvi.cChildren = 1;
|
||||
|
||||
|
||||
// Save the heading level in the item's application-defined data area.
|
||||
tvi.lParam = (LPARAM)nLevel;
|
||||
|
||||
tvins.item = tvi;
|
||||
tvins.hInsertAfter = hPrev;
|
||||
|
||||
// Set the parent item based on the specified level.
|
||||
if (nLevel == 1)
|
||||
tvins.hParent = TVI_ROOT;
|
||||
else if (nLevel == 2)
|
||||
tvins.hParent = hPrevRootItem;
|
||||
else
|
||||
tvins.hParent = hPrevLev2Item;
|
||||
|
||||
// Add the item to the tree view control.
|
||||
hPrev = (HTREEITEM)SendMessage(hwndTV, TVM_INSERTITEM, 0, (LPARAM)(LPTVINSERTSTRUCT)&tvins);
|
||||
|
||||
// Save the handle to the item.
|
||||
if (nLevel == 1)
|
||||
hPrevRootItem = hPrev;
|
||||
else if (nLevel == 2)
|
||||
hPrevLev2Item = hPrev;
|
||||
|
||||
// The new item is a child item. Give the parent item a
|
||||
// closed folder bitmap to indicate it now has child items.
|
||||
if (nLevel > 1) {
|
||||
hti = TreeView_GetParent(hwndTV, hPrev);
|
||||
tvi.mask = TVIF_IMAGE | TVIF_SELECTEDIMAGE;
|
||||
tvi.hItem = hti;
|
||||
tvi.iImage = Image_Closed;
|
||||
tvi.iSelectedImage = Image_Closed;
|
||||
TreeView_SetItem(hwndTV, &tvi);
|
||||
}
|
||||
|
||||
return hPrev;
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
|
||||
|
||||
static void init_output(HWND hWnd)
|
||||
{
|
||||
// TCHAR b[16];
|
||||
// HFONT old_font;
|
||||
HDC hdc = GetDC(hWnd);
|
||||
|
||||
// if (GetNumberFormat(LOCALE_USER_DEFAULT, 0, _T("1000"), 0, b, 16) > 4)
|
||||
// Globals.num_sep = b[1];
|
||||
// else
|
||||
// Globals.num_sep = _T('.');
|
||||
|
||||
// old_font = SelectFont(hdc, Globals.hFont);
|
||||
// GetTextExtentPoint32(hdc, _T(" "), 1, &Globals.spaceSize);
|
||||
// SelectFont(hdc, old_font);
|
||||
ReleaseDC(hWnd, hdc);
|
||||
}
|
||||
|
||||
static HTREEITEM AddEntryToTree(HWND hwndTV, Entry* entry, LPTSTR label)
|
||||
{
|
||||
HTREEITEM hItem = 0;
|
||||
|
@ -203,84 +116,28 @@ static HTREEITEM AddEntryToTree(HWND hwndTV, Entry* entry, LPTSTR label)
|
|||
hPrevRootItem = hPrev;
|
||||
else if (entry->level == 1)
|
||||
hPrevLev2Item = hPrev;
|
||||
/*
|
||||
// The new item is a child item. Give the parent item a
|
||||
// closed folder bitmap to indicate it now has child items.
|
||||
if (entry->level > 1) {
|
||||
HTREEITEM hti;
|
||||
hti = TreeView_GetParent(hwndTV, hPrev);
|
||||
tvi.mask = TVIF_IMAGE | TVIF_SELECTEDIMAGE;
|
||||
tvi.hItem = hti;
|
||||
tvi.iImage = Image_Closed;
|
||||
tvi.iSelectedImage = Image_Closed;
|
||||
TreeView_SetItem(hwndTV, &tvi);
|
||||
}
|
||||
*/
|
||||
hItem = hPrev;
|
||||
return hItem;
|
||||
}
|
||||
|
||||
// insert treectrl entries after index idx
|
||||
static void insert_tree_entries(HWND hWnd, Entry* entry, int idx)
|
||||
static Entry* CreateEntry(Entry* pParentEntry, HKEY hKey, LPCTSTR szKeyName)
|
||||
{
|
||||
static HTREEITEM hItemVisible;
|
||||
static int hItemVisibleIdx;
|
||||
Entry* pEntry = NULL;
|
||||
|
||||
if (!entry)
|
||||
return;
|
||||
|
||||
if (entry->hTreeItem)
|
||||
return;
|
||||
|
||||
ShowWindow(hWnd, SW_HIDE);
|
||||
for(; entry; entry=entry->next) {
|
||||
/*
|
||||
#ifndef _LEFT_FILES
|
||||
if (!(entry->data.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY))
|
||||
continue;
|
||||
#endif
|
||||
// don't display entries "." and ".." in the left pane
|
||||
if ((entry->data.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) && entry->data.cFileName[0]==_T('.')) {
|
||||
if (entry->data.cFileName[1] == _T('\0') ||
|
||||
(entry->data.cFileName[1] == _T('.') &&
|
||||
entry->data.cFileName[2] == _T('\0'))) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
//TRACE("Adding item %u [level:%u] - %s\n", ++idx, entry->level, entry->data.cFileName);
|
||||
*/
|
||||
if (entry->hTreeItem) continue;
|
||||
|
||||
entry->hTreeItem = AddEntryToTree(hWnd, entry, NULL);
|
||||
if (entry->expanded) {
|
||||
insert_tree_entries(hWnd, entry->down, idx + 1);
|
||||
TreeView_Expand(hWnd, entry->hTreeItem, TVE_EXPAND);
|
||||
}
|
||||
if (idx > hItemVisibleIdx) {
|
||||
hItemVisibleIdx = idx;
|
||||
hItemVisible = entry->hTreeItem;
|
||||
}
|
||||
}
|
||||
if (hItemVisible && idx == 0) {
|
||||
TreeView_SelectSetFirstVisible(hWnd, hItemVisible);
|
||||
}
|
||||
ShowWindow(hWnd, SW_SHOW);
|
||||
pEntry = malloc(sizeof(Entry));
|
||||
memset(pEntry, 0, sizeof(Entry));
|
||||
//pEntry->up = pParentEntry;
|
||||
pEntry->level = 1;
|
||||
pEntry->hKey = hKey;
|
||||
_tcsncpy(pEntry->szName, szKeyName, MAX_NAME_LEN);
|
||||
// pEntry->hTreeItem = AddEntryToTree(hwndTV, pEntry, szKeyName);
|
||||
return pEntry;
|
||||
}
|
||||
|
||||
static BOOL InitTreeViewItems(HWND hwndTV, Root* pRoot/*LPCTSTR pHostName*/)
|
||||
{
|
||||
// HRESULT key;
|
||||
//HRESULT openKey(LPSTR stdInput)
|
||||
// key = openKey("HKEY_CLASSES_ROOT");
|
||||
//LPSTR getRegKeyName(LPSTR lpLine);
|
||||
//HKEY getRegClass(LPSTR lpLine);
|
||||
// closeKey();
|
||||
|
||||
#define MAX_NAME_LEN 500
|
||||
|
||||
HKEY hKey;
|
||||
LONG errCode;
|
||||
Entry* pPrevEntry;
|
||||
// HKEY hKey;
|
||||
// LONG errCode;
|
||||
Entry* pEntry = &pRoot->entry;
|
||||
HTREEITEM hRootItem;
|
||||
|
||||
|
@ -288,131 +145,23 @@ static BOOL InitTreeViewItems(HWND hwndTV, Root* pRoot/*LPCTSTR pHostName*/)
|
|||
// HTREEITEM hRootItem = AddItemToTree(hwndTV, pHostName, 1);
|
||||
// pEntry = malloc(sizeof(Entry));
|
||||
// memset(pEntry, 0, sizeof(Entry));
|
||||
// memset(pEntry, 0, sizeof(Entry));
|
||||
//insert_tree_entries(hwndTV, pEntry, 0);
|
||||
|
||||
pEntry->level = 0;
|
||||
pEntry->hTreeItem = AddEntryToTree(hwndTV, pEntry, pRoot->path);
|
||||
hRootItem = pEntry->hTreeItem;
|
||||
pPrevEntry = pEntry;
|
||||
//HTREEITEM AddItemToTree(HWND hwndTV, LPTSTR lpszItem, int nLevel)
|
||||
//HTREEITEM AddEntryToTree(HWND hwndTV, Entry* entry)
|
||||
//static void insert_tree_entries(HWND hWnd, Entry* entry, int idx)
|
||||
|
||||
pEntry = malloc(sizeof(Entry));
|
||||
memset(pEntry, 0, sizeof(Entry));
|
||||
pEntry->up = &pRoot->entry;
|
||||
pEntry->level = 1;
|
||||
pEntry->hTreeItem = AddEntryToTree(hwndTV, pEntry, _T("HKEY_CLASSES_ROOT"));
|
||||
|
||||
pEntry = malloc(sizeof(Entry));
|
||||
memset(pEntry, 0, sizeof(Entry));
|
||||
pEntry->up = &pRoot->entry;
|
||||
pEntry->level = 1;
|
||||
pEntry->hTreeItem = AddEntryToTree(hwndTV, pEntry, _T("HKEY_CURRENT_USER"));
|
||||
|
||||
pEntry = malloc(sizeof(Entry));
|
||||
memset(pEntry, 0, sizeof(Entry));
|
||||
pEntry->up = &pRoot->entry;
|
||||
pEntry->level = 1;
|
||||
pEntry->hTreeItem = AddEntryToTree(hwndTV, pEntry, _T("HKEY_LOCAL_MACHINE"));
|
||||
|
||||
pPrevEntry = pEntry;
|
||||
|
||||
errCode = RegOpenKeyEx(HKEY_LOCAL_MACHINE, NULL, 0, KEY_READ, &hKey);
|
||||
if (errCode == ERROR_SUCCESS) {
|
||||
TCHAR Name[MAX_NAME_LEN];
|
||||
TCHAR Class[MAX_NAME_LEN];
|
||||
FILETIME LastWriteTime;
|
||||
DWORD dwIndex = 0L;
|
||||
DWORD cName = MAX_NAME_LEN;
|
||||
DWORD cClass = MAX_NAME_LEN;
|
||||
while (RegEnumKeyEx(hKey, dwIndex, Name, &cName, NULL, Class, &cClass, &LastWriteTime) == ERROR_SUCCESS) {
|
||||
//AddItemToTree(hwndTV, Name, 2);
|
||||
pEntry = malloc(sizeof(Entry));
|
||||
memset(pEntry, 0, sizeof(Entry));
|
||||
pEntry->up = pPrevEntry;
|
||||
pEntry->hKey = hKey;
|
||||
pEntry->bKey = TRUE;
|
||||
//insert_tree_entries(hwndTV, pEntry, 0);
|
||||
pEntry->level = 2;
|
||||
// pEntry->hTreeItem = AddEntryToTree(hwndTV, pEntry, Name);
|
||||
pEntry->hTreeItem = AddEntryToTree(hwndTV, pEntry, NULL);
|
||||
cName = MAX_NAME_LEN;
|
||||
cClass = MAX_NAME_LEN;
|
||||
++dwIndex;
|
||||
}
|
||||
RegCloseKey(hKey);
|
||||
TreeView_Expand(hwndTV, hRootItem, TVE_EXPAND);
|
||||
}
|
||||
|
||||
pEntry = malloc(sizeof(Entry));
|
||||
memset(pEntry, 0, sizeof(Entry));
|
||||
pEntry->up = &pRoot->entry;
|
||||
pEntry->level = 1;
|
||||
pEntry->hTreeItem = AddEntryToTree(hwndTV, pEntry, _T("HKEY_USERS"));
|
||||
|
||||
pEntry = malloc(sizeof(Entry));
|
||||
memset(pEntry, 0, sizeof(Entry));
|
||||
pEntry->up = &pRoot->entry;
|
||||
pEntry->level = 1;
|
||||
pEntry->hTreeItem = AddEntryToTree(hwndTV, pEntry, _T("HKEY_CURRENT_CONFIG"));
|
||||
|
||||
pEntry = CreateEntry(&pRoot->entry, HKEY_CLASSES_ROOT, _T("HKEY_CLASSES_ROOT"));
|
||||
pEntry->hTreeItem = AddEntryToTree(hwndTV, pEntry, NULL);
|
||||
pEntry = CreateEntry(&pRoot->entry, HKEY_CURRENT_USER, _T("HKEY_CURRENT_USER"));
|
||||
pEntry->hTreeItem = AddEntryToTree(hwndTV, pEntry, NULL);
|
||||
pEntry = CreateEntry(&pRoot->entry, HKEY_LOCAL_MACHINE, _T("HKEY_LOCAL_MACHINE"));
|
||||
pEntry->hTreeItem = AddEntryToTree(hwndTV, pEntry, NULL);
|
||||
pEntry = CreateEntry(&pRoot->entry, HKEY_USERS, _T("HKEY_USERS"));
|
||||
pEntry->hTreeItem = AddEntryToTree(hwndTV, pEntry, NULL);
|
||||
pEntry = CreateEntry(&pRoot->entry, HKEY_CURRENT_CONFIG, _T("HKEY_CURRENT_CONFIG"));
|
||||
pEntry->hTreeItem = AddEntryToTree(hwndTV, pEntry, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
/*
|
||||
AddItemToTree(hwndTV, _T("HKEY_CLASSES_ROOT"), 2);
|
||||
AddItemToTree(hwndTV, _T("HKEY_CURRENT_USER"), 2);
|
||||
AddItemToTree(hwndTV, _T("HKEY_LOCAL_MACHINE"), 2);
|
||||
AddItemToTree(hwndTV, _T("HKEY_USERS"), 2);
|
||||
AddItemToTree(hwndTV, _T("HKEY_CURRENT_CONFIG"), 2);
|
||||
*/
|
||||
/*
|
||||
LONG RegOpenKeyEx(
|
||||
HKEY hKey, // handle to open key
|
||||
LPCTSTR lpSubKey, // subkey name
|
||||
DWORD ulOptions, // reserved
|
||||
REGSAM samDesired, // security access mask
|
||||
PHKEY phkResult // handle to open key
|
||||
);
|
||||
|
||||
LONG RegEnumKey(
|
||||
HKEY hKey, // handle to key to query
|
||||
DWORD dwIndex, // index of subkey to query
|
||||
LPTSTR lpName, // buffer for subkey name
|
||||
DWORD cbName // size of subkey name buffer
|
||||
);
|
||||
|
||||
LONG RegEnumKeyEx(
|
||||
HKEY hKey, // handle to key to enumerate
|
||||
DWORD dwIndex, // subkey index
|
||||
LPTSTR lpName, // subkey name
|
||||
LPDWORD lpcName, // size of subkey buffer
|
||||
LPDWORD lpReserved, // reserved
|
||||
LPTSTR lpClass, // class string buffer
|
||||
LPDWORD lpcClass, // size of class string buffer
|
||||
PFILETIME lpftLastWriteTime // last write time
|
||||
);
|
||||
*/
|
||||
|
||||
/*
|
||||
RegCloseKey
|
||||
RegConnectRegistryW
|
||||
RegCreateKeyW
|
||||
RegDeleteKeyW
|
||||
RegDeleteValueW
|
||||
RegEnumKeyW
|
||||
RegEnumValueW
|
||||
RegFlushKey
|
||||
RegOpenKeyExA
|
||||
RegOpenKeyExW
|
||||
RegOpenKeyW
|
||||
RegQueryInfoKeyW
|
||||
RegQueryValueExA
|
||||
RegQueryValueExW
|
||||
RegSetValueExA
|
||||
RegSetValueExW
|
||||
RegSetValueW
|
||||
*/
|
||||
|
||||
// InitTreeViewImageLists - creates an image list, adds three bitmaps
|
||||
// to it, and associates the image list with a tree view control.
|
||||
|
@ -459,13 +208,6 @@ static BOOL InitTreeViewImageLists(HWND hwndTV)
|
|||
|
||||
static void OnGetDispInfo(NMTVDISPINFO* ptvdi)
|
||||
{
|
||||
FILETIME LastWriteTime;
|
||||
TCHAR Class[MAX_NAME_LEN];
|
||||
DWORD cClass = MAX_NAME_LEN;
|
||||
// TCHAR Name[MAX_NAME_LEN];
|
||||
// DWORD cName = MAX_NAME_LEN;
|
||||
// DWORD dwIndex = 0L;
|
||||
|
||||
Entry* pEntry = (Entry*)ptvdi->item.lParam;
|
||||
ASSERT(pEntry);
|
||||
|
||||
|
@ -479,6 +221,7 @@ static void OnGetDispInfo(NMTVDISPINFO* ptvdi)
|
|||
ptvdi->item.iSelectedImage = Image_Closed;
|
||||
}
|
||||
if (ptvdi->item.mask & TVIF_TEXT) {
|
||||
/*
|
||||
ptvdi->item.pszText = _T("Unknown");
|
||||
ptvdi->item.cchTextMax = _tcslen(ptvdi->item.pszText);
|
||||
if (pEntry->bKey == TRUE) {
|
||||
|
@ -496,32 +239,16 @@ static void OnGetDispInfo(NMTVDISPINFO* ptvdi)
|
|||
&MaxValueNameLen, &MaxValueLen, &SecurityDescriptorLen,
|
||||
&LastWriteTime);
|
||||
if (result == ERROR_SUCCESS) {
|
||||
// ptvdi->item.pszText = Class;
|
||||
// ptvdi->item.cchTextMax = cClass;
|
||||
ptvdi->item.pszText = Class;
|
||||
ptvdi->item.cchTextMax = cClass;
|
||||
}
|
||||
}
|
||||
// ptvdi->item.pszText = entry->data.cFileName;
|
||||
// ptvdi->item.cchTextMax = lstrlen(entry->data.cFileName);
|
||||
*/
|
||||
ptvdi->item.pszText = pEntry->szName;
|
||||
ptvdi->item.cchTextMax = lstrlen(pEntry->szName);
|
||||
}
|
||||
}
|
||||
|
||||
// OnEndLabelEdit - processes the LVN_ENDLABELEDIT notification message.
|
||||
// Returns TRUE if the label is changed, or FALSE otherwise.
|
||||
|
||||
static BOOL OnEndLabelEdit(NMTVDISPINFO* ptvdi)
|
||||
{
|
||||
// if (ptvdi->item.iItem == -1)
|
||||
// return FALSE;
|
||||
|
||||
// Copy the new label text to the application-defined structure.
|
||||
// lstrcpyn(rgPetInfo[ptvdi->item.iItem].szKind, ptvdi->item.pszText, 10);
|
||||
|
||||
return TRUE;
|
||||
// To make a more robust application you should send an EM_LIMITTEXT
|
||||
// message to the edit control to prevent the user from entering too
|
||||
// many characters in the field.
|
||||
}
|
||||
|
||||
static BOOL OnExpand(int flag, HTREEITEM* pti)
|
||||
{
|
||||
TRACE(_T("TreeWndProc(...) OnExpand()\n"));
|
||||
|
@ -539,14 +266,32 @@ TVE_TOGGLE Collapses the list if it is expanded or expands it if it is collapsed
|
|||
static BOOL OnExpanding(HWND hWnd, NMTREEVIEW* pnmtv)
|
||||
{
|
||||
static int expanding;
|
||||
HKEY hKey;
|
||||
LONG errCode;
|
||||
|
||||
Entry* entry = (Entry*)pnmtv->itemNew.lParam;
|
||||
TRACE(_T("TreeWndProc(...) OnExpanding() entry: %p\n"), entry);
|
||||
if (expanding) return FALSE;
|
||||
expanding = TRUE;
|
||||
if (entry) {
|
||||
insert_tree_entries(hWnd, entry->down, 0);
|
||||
// insert_tree_entries(hWnd, entry, 0);
|
||||
errCode = RegOpenKeyEx(entry->hKey, NULL, 0, KEY_READ, &hKey);
|
||||
if (errCode == ERROR_SUCCESS) {
|
||||
TCHAR Name[MAX_NAME_LEN];
|
||||
DWORD cName = MAX_NAME_LEN;
|
||||
FILETIME LastWriteTime;
|
||||
DWORD dwIndex = 0L;
|
||||
while (RegEnumKeyEx(hKey, dwIndex, Name, &cName, NULL, NULL, NULL, &LastWriteTime) == ERROR_SUCCESS) {
|
||||
Entry* pEntry = CreateEntry(entry, hKey, Name);
|
||||
pEntry->up = entry;
|
||||
pEntry->hKey = hKey;
|
||||
pEntry->bKey = TRUE;
|
||||
pEntry->level = 2;
|
||||
pEntry->hTreeItem = AddEntryToTree(hWnd, pEntry, NULL);
|
||||
cName = MAX_NAME_LEN;
|
||||
++dwIndex;
|
||||
}
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
}
|
||||
expanding = FALSE;
|
||||
return TRUE;
|
||||
|
@ -567,8 +312,8 @@ static WNDPROC g_orgTreeWndProc;
|
|||
static LRESULT CALLBACK TreeWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
// ChildWnd* child = (ChildWnd*)GetWindowLong(GetParent(hWnd), GWL_USERDATA);
|
||||
// Pane* pane = (Pane*)GetWindowLong(hWnd, GWL_USERDATA);
|
||||
// ASSERT(child);
|
||||
|
||||
switch (message) {
|
||||
case WM_NOTIFY:
|
||||
switch (((LPNMHDR)lParam)->code) {
|
||||
|
@ -582,7 +327,7 @@ static LRESULT CALLBACK TreeWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
|
|||
case TVN_ITEMEXPANDING:
|
||||
return OnExpanding(hWnd, (NMTREEVIEW*)lParam);
|
||||
break;
|
||||
case TVN_SELCHANGED:
|
||||
// case TVN_SELCHANGED:
|
||||
// return OnSelChanged((NMTREEVIEW*)lParam);
|
||||
// break;
|
||||
#if 0
|
||||
|
@ -594,15 +339,8 @@ static LRESULT CALLBACK TreeWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
|
|||
// return TVNRET_SKIPNEW; // Skip default processing of the item being selected.
|
||||
break;
|
||||
#endif
|
||||
case TVN_ENDLABELEDIT:
|
||||
return OnEndLabelEdit((NMTVDISPINFO*)lParam);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
break;
|
||||
case WM_SETFOCUS:
|
||||
//child->nFocusPanel = pane == &child->right? 1: 0;
|
||||
//TODO: check menu items
|
||||
// return 0;
|
||||
break;
|
||||
case WM_KEYDOWN:
|
||||
if (wParam == VK_TAB) {
|
||||
|
@ -614,20 +352,16 @@ static LRESULT CALLBACK TreeWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
|
|||
}
|
||||
|
||||
// CreateTreeView - creates a tree view control.
|
||||
// Returns the handle to the new control if successful,
|
||||
// or NULL otherwise.
|
||||
// Returns the handle to the new control if successful, or NULL otherwise.
|
||||
// hwndParent - handle to the control's parent window.
|
||||
|
||||
HWND CreateTreeView(HWND hwndParent/*, Pane* pane*/, int id, Root* pRoot/*LPTSTR lpszPathName*/)
|
||||
HWND CreateTreeView(HWND hwndParent, int id, Root* pRoot)
|
||||
{
|
||||
RECT rcClient; // dimensions of client area
|
||||
HWND hwndTV; // handle to tree view control
|
||||
// static int s_init = 0;
|
||||
// Entry* entry = pane->root;
|
||||
// pane->treePane = 1;
|
||||
RECT rcClient;
|
||||
HWND hwndTV;
|
||||
// Entry* entry = ;
|
||||
|
||||
// Get the dimensions of the parent window's client area, and create
|
||||
// the tree view control.
|
||||
// Get the dimensions of the parent window's client area, and create the tree view control.
|
||||
GetClientRect(hwndParent, &rcClient);
|
||||
hwndTV = CreateWindowEx(0, WC_TREEVIEW, _T("Tree View"),
|
||||
WS_VISIBLE | WS_CHILD | WS_BORDER | TVS_HASLINES | TVS_HASBUTTONS | TVS_LINESATROOT,
|
||||
|
@ -638,22 +372,9 @@ HWND CreateTreeView(HWND hwndParent/*, Pane* pane*/, int id, Root* pRoot/*LPTSTR
|
|||
DestroyWindow(hwndTV);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SetWindowLong(hwndTV, GWL_USERDATA, (LPARAM)0);
|
||||
g_orgTreeWndProc = SubclassWindow(hwndTV, TreeWndProc);
|
||||
//SendMessage(hwndTV, WM_SETFONT, (WPARAM)Globals.hFont, FALSE);
|
||||
|
||||
// insert entries into treectrl
|
||||
// if (entry) {
|
||||
// insert_tree_entries(hwndTV, entry, 0);
|
||||
// }
|
||||
|
||||
// calculate column widths
|
||||
// if (!s_init) {
|
||||
// s_init = 1;
|
||||
// init_output(hwndTV);
|
||||
// }
|
||||
|
||||
return hwndTV;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue