Re: Odd Problem with CRegKey
Try setting the count to the size of the buffer before making the call.
regkey.queryvalue seems to call RegQueryValueEx which expects to know the size of the buffer. Many registry key functions take the buffer size as an input argument then change it to the size actually supplied when they return. It's easy to get caught out by that, especially in a loop where you can forget to set it back on each iteration.
If I'm right then the documentation on QueryValue at V5 is wrong so you can blame MS, though checking the status code returned would probably have said something like "buffer too small" as a hint.
Cheers,
Roger