Login | |
|
 |
RE: arrayList not populating correctly - 4/17/2008 9:07:56 AM
|
|
 |
|
| |
ebgreen
Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
|
Go through the recursion in your head. The first time that the function it is called it is called with LNGHKEY = "HKLM". So it goes through the If-Then construct and it sets hkroot to the constant HKEY_LOCAL_MACHINE. It uses this to make an array of all the top level subkeys. Now it calls itself again passing in hkroot as LNGHKEY. So now it is checking one level down and it goes through the if-then construct and none of the defined options matches LNGHKEY (remember it was passed in a value of HKEY_LOCAL_MACHINE). Since it doesn't see a match it defaults to HKCU. There is no such key in HKCU so voila it moves right along. The reason the second version runs so much faster is because it really only checks the top level keys.
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
 |
RE: arrayList not populating correctly - 4/21/2008 12:38:57 AM
|
|
 |
|
| |
ebgreen
Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
|
When you call the function for the subkeys, you are still calling it with hkroot which has a value of &H80000002. That value is nowhere in your if-then tests so it will still default to HKCU.
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
|
|