Commit f3c4cca7 authored by Hugh McMaster's avatar Hugh McMaster Committed by Alexandre Julliard

regedit: Add listview entries without refreshing the listview.

parent ebfe566c
......@@ -443,8 +443,9 @@ BOOL CreateValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, DWORD valueType, LPW
WCHAR newValue[256];
DWORD valueDword = 0;
BOOL result = FALSE;
int valueNum;
int valueNum, index;
HKEY hKey;
LVITEMW item;
lRet = RegOpenKeyExW(hKeyRoot, keyPath, 0, KEY_READ | KEY_SET_VALUE, &hKey);
if (lRet != ERROR_SUCCESS) {
......@@ -470,6 +471,13 @@ BOOL CreateValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, DWORD valueType, LPW
error_code_messagebox(hwnd, IDS_CREATE_VALUE_FAILED);
goto done;
}
/* Add the new item to the listview */
index = AddEntryToList(g_pChildWnd->hListWnd, valueName, valueType, (BYTE *)&valueDword, sizeof(DWORD));
item.state = LVIS_FOCUSED | LVIS_SELECTED;
item.stateMask = LVIS_FOCUSED | LVIS_SELECTED;
SendMessageW(g_pChildWnd->hListWnd, LVM_SETITEMSTATE, index, (LPARAM)&item);
result = TRUE;
done:
......
......@@ -861,10 +861,8 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
WCHAR* keyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hKeyRoot);
WCHAR newKey[MAX_NEW_KEY_LEN];
if (CreateValue(hWnd, hKeyRoot, keyPath, valueType, newKey)) {
RefreshListView(g_pChildWnd->hListWnd, hKeyRoot, keyPath, newKey);
if (CreateValue(hWnd, hKeyRoot, keyPath, valueType, newKey))
StartValueRename(g_pChildWnd->hListWnd);
}
HeapFree(GetProcessHeap(), 0, keyPath);
}
break;
......
......@@ -109,7 +109,7 @@ static void MakeMULTISZDisplayable(LPWSTR multi)
/*******************************************************************************
* Local module support methods
*/
static void AddEntryToList(HWND hwndLV, LPWSTR Name, DWORD dwValType, void *ValBuf, DWORD dwCount)
int AddEntryToList(HWND hwndLV, WCHAR *Name, DWORD dwValType, void *ValBuf, DWORD dwCount)
{
LINE_INFO* linfo;
LVITEMW item;
......@@ -202,6 +202,7 @@ static void AddEntryToList(HWND hwndLV, LPWSTR Name, DWORD dwValType, void *ValB
}
}
}
return index;
}
static BOOL InitListViewImageList(HWND hWndListView)
......
......@@ -117,6 +117,7 @@ extern void SetupStatusBar(HWND hWnd, BOOL bResize);
extern void UpdateStatusBar(void);
/* listview.c */
extern int AddEntryToList(HWND hwndLV, WCHAR *Name, DWORD dwValType, void *ValBuf, DWORD dwCount);
extern HWND CreateListView(HWND hwndParent, UINT id);
extern BOOL RefreshListView(HWND hwndLV, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR highlightValue);
extern HWND StartValueRename(HWND hwndLV);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment