regenumkeyex problem

This is a discussion on regenumkeyex problem within the Windows Programming forums, part of the Platform Specific Boards category; i'm making a simple program to retvive some registery values of internet explorer but i'm stuck with the regenumkeyex function,in ...

  1. #1
    Registered User
    Join Date
    Jun 2003
    Posts
    2

    regenumkeyex problem

    i'm making a simple program to retvive some registery values of internet explorer but i'm stuck with the regenumkeyex function,in the code below the program should retvive the subkeys under internet explorer registery key (which is 21 keys) and add it to a combo box so the user choose which subkey he want to enter to change values in it but when i run the program only this values is added to the combo box
    1-default html editor
    2-desktop
    3-desktop <----twice

    so can you please tell me what is wrong with this code ? (why the "desktop" entry is cloned and why dosen't it retvive all the 21 subkeys)/

    btw...i have some doubts about the second paramter in regenumkeyex function (the subkey index)
    Code:
    	HKEY iesub;
    	LONG retsubkeys;
    	DWORD i;
    	DWORD subsize=255;
    	char subkeys[255];
    	if (RegOpenKeyEx(HKEY_CURRENT_USER,"software\\microsoft\\internet explorer",0,KEY_ALL_ACCESS,&iesub)==ERROR_SUCCESS)
    	{
    
    	
    		for (i=0,retsubkeys=ERROR_SUCCESS;retsubkeys==ERROR_SUCCESS;i++)
    	{
    
    		retsubkeys=RegEnumKeyEx(iesub,i,subkeys,&subsize,NULL,NULL,NULL,NULL );
    		
    
    
    		m_combo.AddString (subkeys);
    
    		
    	}
    	
    	
    	}

  2. #2
    Registered User
    Join Date
    Jun 2003
    Posts
    245
    You doing the "m_combo.AddString (subkeys);" regardless of whether the "retsubkeys=RegEnumKeyEx(iesub,i,subkeys,&subsize, NULL,NULL,NULL,NULL );" actually succeeded or not, so that's why your getting an entry twice. Either use a while loop, or put another check in there before adding to the combo box.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 05:21 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 09:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 03:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 07:54 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21