Click here to Skip to main content
16,005,178 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: MC++ null keyword Pin
S. Senthil Kumar5-Nov-05 1:16
S. Senthil Kumar5-Nov-05 1:16 
QuestionProblems after installing Visual Studio 2005 [FIXED] Pin
ddmcr4-Nov-05 23:32
ddmcr4-Nov-05 23:32 
QuestionError 10055 Pin
vani_bel4-Nov-05 22:59
vani_bel4-Nov-05 22:59 
AnswerRe: Error 10055 Pin
Mircea Puiu4-Nov-05 23:10
Mircea Puiu4-Nov-05 23:10 
QuestionTrain free @Microsoft Pin
vikas amin4-Nov-05 22:42
vikas amin4-Nov-05 22:42 
GeneralRe: Train free @Microsoft Pin
gr8coaster3295-Nov-05 11:32
gr8coaster3295-Nov-05 11:32 
AnswerRe: Train free @Microsoft Pin
ThatsAlok6-Nov-05 19:18
ThatsAlok6-Nov-05 19:18 
QuestionRegistry Tree Pin
rajeevktripathi4-Nov-05 20:43
rajeevktripathi4-Nov-05 20:43 
Hi All

I am making a dilog based application where I need to enumerate registry keys and all its subkys,
I am able to enumerate all keys and subkeys,
Now the problem is that I want to diplay all the keys in tree form( by CTreeCtrl class) as in regedit.
I am using following code for enumerating keys and subkeys
Here all subkeys of "HKEY_CLASSES_ROOT" are enumerated.
<br />
<br />
LONG lResult;<br />
int iDepth = 0;<br />
CString cstrKeyRootName = _T("HKEY_CLASSES_ROOT");<br />
CString cstrKeyName = _T("");<br />
CString cstrFullPathStr;<br />
<br />
	<br />
HKEY hCurKey, hPrevKey;<br />
HKEY hParentKey[100];<br />
DWORD dwParentIndex[100];<br />
TCHAR strCurString[1024], strPrevString[1024];<br />
TCHAR strParentString[1024][100];<br />
DWORD dwCurIndex = 0, dwPrevIndex = 0;<br />
HKEY hKeyRootName = HKEY_CLASSES_ROOT;<br />
<br />
lResult = RegOpenKeyEx(hKeyRootName, cstrKeyName, 0, KEY_ENUMERATE_SUB_KEYS, &hCurKey);<br />
<br />
if(cstrKeyName.IsEmpty())<br />
	cstrFullPathStr = cstrKeyRootName;<br />
else<br />
	cstrFullPathStr = cstrKeyRootName + _T("\\") + cstrKeyName;<br />
<br />
do<br />
{<br />
	lResult = RegEnumKey(hCurKey, dwCurIndex, strCurString, sizeof(strCurString));<br />
<br />
	hPrevKey = hCurKey;<br />
	dwPrevIndex = dwCurIndex;<br />
	_tcscpy(strPrevString, strCurString);<br />
<br />
	if((lResult == ERROR_NO_MORE_ITEMS) || (lResult == ERROR_INVALID_HANDLE))<br />
	{<br />
							<br />
		iDepth--;<br />
		if(iDepth < 0)<br />
         	  break;<br />
		  <br />
<br />
		hCurKey = hParentKey[iDepth];<br />
		dwCurIndex = dwParentIndex[iDepth] + 1;<br />
		_tcscpy(strCurString, strParentString[iDepth]);<br />
<br />
		int i = cstrFullPathStr.ReverseFind(_T('\\'));<br />
		CString cstrTemp;<br />
		cstrTemp = cstrFullPathStr.Left(i);<br />
		cstrFullPathStr = cstrTemp;<br />
<br />
		continue;<br />
	}<br />
<br />
	else<br />
	{<br />
	        hParentKey[iDepth] = hCurKey;<br />
		dwParentIndex[iDepth] = dwCurIndex;<br />
		_tcscpy(strParentString[iDepth], strCurString);<br />
<br />
		cstrFullPathStr += _T("\\");<br />
		cstrFullPathStr += strCurString;<br />
<br />
		lResult = RegOpenKeyEx(hCurKey, strCurString, 0, KEY_ENUMERATE_SUB_KEYS, &hCurKey);<br />
<br />
		iDepth ++;<br />
		dwCurIndex = 0;<br />
	}<br />
<br />
}while(TRUE);<br />
<br />


Now I have been stucked that how to insert these keys into tree.

please tell the modification in the code for inserting keys into the tree.


Please reply.
Thanks
AnswerRe: Registry Tree Pin
Phil J Pearson5-Nov-05 1:03
Phil J Pearson5-Nov-05 1:03 
QuestionRe: Registry Tree Pin
rajeevktripathi6-Nov-05 19:10
rajeevktripathi6-Nov-05 19:10 
AnswerRe: Registry Tree Pin
ThatsAlok6-Nov-05 19:32
ThatsAlok6-Nov-05 19:32 
QuestionRe: Registry Tree Pin
rajeevktripathi6-Nov-05 20:08
rajeevktripathi6-Nov-05 20:08 
AnswerRe: Registry Tree Pin
ThatsAlok6-Nov-05 20:58
ThatsAlok6-Nov-05 20:58 
GeneralRe: Registry Tree Pin
rajeevktripathi8-Nov-05 19:17
rajeevktripathi8-Nov-05 19:17 
QuestionMFC CHM Reference Pin
t3j04-Nov-05 20:31
t3j04-Nov-05 20:31 
AnswerRe: MFC CHM Reference Pin
qfegd5-Nov-05 1:00
qfegd5-Nov-05 1:00 
AnswerRe: MFC CHM Reference Pin
toxcct5-Nov-05 1:02
toxcct5-Nov-05 1:02 
QuestionHow to get the button text of a TBBUTTON? Pin
Tcpip20054-Nov-05 20:09
Tcpip20054-Nov-05 20:09 
AnswerRe: How to get the button text of a TBBUTTON? Pin
Tcpip20054-Nov-05 20:12
Tcpip20054-Nov-05 20:12 
GeneralRe: How to get the button text of a TBBUTTON? Pin
ThatsAlok6-Nov-05 20:56
ThatsAlok6-Nov-05 20:56 
AnswerRe: How to get the button text of a TBBUTTON? Pin
Gary R. Wheeler6-Nov-05 4:34
Gary R. Wheeler6-Nov-05 4:34 
QuestionHow can i make my Exe as a Service Pin
snprani4-Nov-05 20:04
snprani4-Nov-05 20:04 
AnswerRe: How can i make my Exe as a Service Pin
Mircea Puiu4-Nov-05 23:25
Mircea Puiu4-Nov-05 23:25 
QuestionRedraw problem Pin
vikas amin4-Nov-05 18:58
vikas amin4-Nov-05 18:58 
AnswerRe: Redraw problem Pin
John R. Shaw4-Nov-05 19:46
John R. Shaw4-Nov-05 19:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.