Results 1 to 4 of 4

Thread: weird looping problem

  1. #1

    Thread Starter
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919

    weird looping problem

    Code:
    	registry.Open(HKEY_CURRENT_USER, _T("Software\\VB and VBA Program Settings\\fbserver\\settings"), FALSE);
    	registry.Read("total",num);
    	registry.Open(HKEY_CURRENT_USER, _T("Software\\VB and VBA Program Settings\\fbserver\\titles"), FALSE);
    	
    	for(int i=1;i<=num;i++){
    		registry.Read(itoa(i,buffer,10),title);
    		lst_favs.AddString(title);
    	}
    	registry.Close();
    when i add to the list box, itll add the last one alot of times, maybe 30 or 40 times. anyone have any idea why?
    Visit www.fragblast.com
    Gaming, forums, and a online RPG/Battle system




    (__Flagg) DOT NET? is this a Hindi Dating service?

  2. #2
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827
    How is your registry.Read function written?
    Baaaaaaaaah

  3. #3

    Thread Starter
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919
    i didn't write it, but here it is:

    Code:
    BOOL CRegisterWIN32::Read(LPCTSTR szKey, LPTSTR &pszValue)
    {
    	BOOL bResult = FALSE;
    	try
    	{
    		if ( StringIN(szKey) )
    		{
    			//** The Key exist so proceed 
    			if( pszValue != NULL )
    				delete pszValue;
    			//** We re-allocate memory on destination pointer
    			pszValue = new _TCHAR[_tcslen(m_szTemp) + 1 * sizeof(TCHAR)];
    			//** Transfert the reading result
    			_tcscpy(pszValue, m_szTemp);
    			bResult = TRUE;
    		}
    	}
    	catch(...)
    	{
    		bResult = FALSE;
    	}
    	return bResult;
    }
    Visit www.fragblast.com
    Gaming, forums, and a online RPG/Battle system




    (__Flagg) DOT NET? is this a Hindi Dating service?

  4. #4

    Thread Starter
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919
    nevermind i fixed it:

    Code:
    if(!registry.Read(itoa(i,buffer,10),title)){
    			break;
    		}
    		lst_favs.AddString(title);
    did that instead
    Visit www.fragblast.com
    Gaming, forums, and a online RPG/Battle system




    (__Flagg) DOT NET? is this a Hindi Dating service?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width