Additional:

When browsing the registry key:
My Computer\HKEY_CURRENT_USER\Control Panel\Appearance\Schemes

and calling GetListCtrl() m_hWnd of ListCtrl becomes NULL. Do you know why it happens?

Ok, let me tell you more. In accessing the above registry key, I get the maximum data size by using RegQueryInfoKey. The maximum data size is 712 bytes. I have a loop that iterates 712 times to convert the data to string format. As you may know, a data whose type is REG_BINARY or REG_DWORD etc cannot be added to the list because they are not in string format. So I write a function that will convert the data from its format to string format.

After the conversion (after 712 iterations), I then call the GetItemCount() method of CListCtrl so that I can add the data to correct position in the list. But in doing so, I get an assertion error because m_hWnd of CListCtrl becomes NULL. Note, this only happens when browsing My Computer\HKEY_CURRENT_USER\Control Panel\Appearance\Schemes There is no problem when browsing other registry key.

Anybody know why this happen?