最好有源代码。
================================================================CSDN 论坛助手 Ver 1.0 B0402提供下载。 改进了很多,功能完备!★  浏览帖子速度极快![建议系统使用ie5.5以上]。 ★  多种帖子实现界面。 
★  保存帖子到本地[html格式]★  监视您关注帖子的回复更新。
★  可以直接发贴、回复帖子★  采用XML接口,可以一次性显示4页帖子,同时支持自定义每次显示帖子数量。可以浏览历史记录! 
★  支持在线检测程序升级情况,可及时获得程序更新的信息。★★ 签名  ●  
     可以在您的每个帖子的后面自动加上一个自己设计的签名哟。Http://www.ChinaOK.net/csdn/csdn.zip
Http://www.ChinaOK.net/csdn/csdn.rar
Http://www.ChinaOK.net/csdn/csdn.exe    [自解压]

解决方案 »

  1.   

    RegEnumKeyEx
    The RegEnumKeyEx function enumerates subkeys of the specified open registry key. The function retrieves information about one subkey each time it is called. Unlike the RegEnumKey function, RegEnumKeyEx retrieves the class name of the subkey and the time it was last modified. LONG RegEnumKeyEx(
      HKEY hKey,                  // handle to key to enumerate
      DWORD dwIndex,              // subkey index
      LPTSTR lpName,              // subkey name
      LPDWORD lpcName,            // size of subkey buffer
      LPDWORD lpReserved,         // reserved
      LPTSTR lpClass,             // class string buffer
      LPDWORD lpcClass,           // size of class string buffer
      PFILETIME lpftLastWriteTime // last write time
    );
    Parameters
    hKey 
    [in] Handle to a currently open key or one of the following predefined reserved handle values: 
    HKEY_CLASSES_ROOT
    HKEY_CURRENT_CONFIG
    HKEY_CURRENT_USER
    HKEY_LOCAL_MACHINE
    HKEY_USERS
    Windows NT/2000: HKEY_PERFORMANCE_DATA 
    Windows 95/98: HKEY_DYN_DATA The enumerated keys are subkeys of the key identified by hKey. dwIndex 
    [in] Specifies the index of the subkey to retrieve. This parameter should be zero for the first call to the RegEnumKeyEx function and then incremented for subsequent calls. 
    Because subkeys are not ordered, any new subkey will have an arbitrary index. This means that the function may return subkeys in any order. lpName 
    [out] Pointer to a buffer that receives the name of the subkey, including the terminating null character. The function copies only the name of the subkey, not the full key hierarchy, to the buffer. 
    lpcName 
    [in/out] Pointer to a variable that specifies the size, in TCHARs, of the buffer specified by the lpName parameter. This size should include the terminating null character. When the function returns, the variable pointed to by lpcName contains the number of characters stored in the buffer. The count returned does not include the terminating null character. 
    lpReserved 
    Reserved; must be NULL. 
    lpClass 
    [in/out] Pointer to a buffer that receives the null-terminated class string of the enumerated subkey. No classes are currently defined; applications should ignore this parameter. This parameter can be NULL. 
    lpcClass 
    [in/out] Pointer to a variable that specifies the size, in TCHARs, of the buffer specified by the lpClass parameter. The size should include the terminating null character. When the function returns, lpcClass contains the number of characters stored in the buffer. The count returned does not include the terminating null character. This parameter can be NULL only if lpClass is NULL. 
    lpftLastWriteTime 
    [out] Pointer to a variable that receives the time the enumerated subkey was last written to. 
    Return Values
    If the function succeeds, the return value is ERROR_SUCCESS.If the function fails, the return value is a nonzero error code defined in Winerror.h. You can use the FormatMessage function with the FORMAT_MESSAGE_FROM_SYSTEM flag to get a generic description of the error.Res
    To enumerate subkeys, an application should initially call the RegEnumKeyEx function with the dwIndex parameter set to zero. The application should then increment the dwIndex parameter and call RegEnumKeyEx until there are no more subkeys (until the function returns ERROR_NO_MORE_ITEMS). The application can also set dwIndex to the index of the last subkey on the first call to the function and decrement the index until the subkey with the index 0 is enumerated. To retrieve the index of the last subkey, use the RegQueryInfoKey function. While an application is using the RegEnumKeyEx function, it should not make calls to any registration functions that might change the key being enumerated. The key identified by hKey must have been opened with KEY_ENUMERATE_SUB_KEYS access (KEY_READ includes KEY_ENUMERATE_SUB_KEYS). Use the RegCreateKeyEx or RegOpenKeyEx function to open the key. Windows 95/98: No registry subkey or value name may exceed 255 characters. Requirements 
      Windows NT/2000: Requires Windows NT 3.1 or later.
      Windows 95/98: Requires Windows 95 or later.
      Header: Declared in Winreg.h; include Windows.h.
      Library: Use Advapi32.lib.
      Unicode: Implemented as Unicode and ANSI versions on Windows NT/2000.See Also
    Registry Overview, Registry Functions, RegCreateKeyEx, RegDeleteKey, RegEnumKey, RegOpenKeyEx, RegQueryInfoKey Built on Friday, April 28, 2000Requirements 
      Windows NT/2000: Requires Windows NT 3.1 or later.
      Windows 95/98: Requires Windows 95 or later.
      Header: Declared in Winreg.h; include Windows.h.
      Library: Use Advapi32.lib.
      Unicode: Implemented as Unicode and ANSI versions on Windows NT/2000.
    See Also
    Registry Overview, Registry Functions, RegCreateKeyEx, RegDeleteKey, RegEnumKey, RegOpenKeyEx, RegQueryInfoKey 
      

  2.   

    以下是我写的一个例子,主要目的是熟悉遍历算法;
    ********************************************************************
    // purpose : to master the arith of bianli
    #include<stdio.h>
    #include<time.h>
    #include<windows.h>HKEY hKey[] = {HKEY_CLASSES_ROOT,
       HKEY_CURRENT_USER,
       HKEY_LOCAL_MACHINE,
       HKEY_USERS,
       HKEY_CURRENT_CONFIG};
    char *sKey[] = {"HEKY_CLASSES_ROOT",
       "HEKY_CURRENT_USER",
       "HEKY_LOCAL_MACHINE",
       "HEKY_USERS",
       "HEKY_CURRENT_CONFIG"};char data_set[1024];
    DWORD nCount = 0; // calculate the keys numbervoid EnumValue(HKEY hKey)
    {
    int dwIndex = 0;
    char valuename[MAX_PATH + 1];
    DWORD valuenamelen;
    DWORD Type;
    union{
    BYTE data[1024];
    DWORD idata;
    }lpdata;
    DWORD datalen; valuenamelen = sizeof(valuename);
    datalen = sizeof(lpdata);
    memset(&lpdata,0,sizeof(lpdata));
    while(::RegEnumValue (hKey,dwIndex,(LPTSTR)valuename,&valuenamelen,
    0,&Type,lpdata.data,&datalen) != ERROR_NO_MORE_ITEMS)
    {
    switch(Type)
    {
    case REG_SZ:
    printf("value:\t%s\tdata:\t%s\n",valuename,(char*)lpdata.data);
    break;
    case REG_DWORD:
    printf("value:\t%sdata:\t%ld\n",valuename,lpdata.idata);
    break;
    default:
    break;
    } dwIndex ++;
    valuenamelen = sizeof(valuename);
    datalen = sizeof(lpdata);
    memset(&lpdata,0,sizeof(lpdata));
    }}void EnumKey(HKEY hKey,char *sKey)
    {
    HKEY h;
    int dwIndex = 0;

    char strkey[2048];
    char name[1024] = {0};
    DWORD namelen = sizeof(name);
    FILETIME ftLastWriteTime; if(::RegOpenKeyEx (hKey,(LPTSTR)data_set,0,KEY_READ,&h) != ERROR_SUCCESS)
    {
    printf("cann't open key %s!\n",strkey);
    return;
    }

    while(::RegEnumKeyEx (h,dwIndex,name,&namelen,0,NULL,NULL,&ftLastWriteTime) != ERROR_NO_MORE_ITEMS)
    {
    EnumValue(h);
    nCount ++;
    printf("%s\\%s\n",sKey,name);
    Sleep(100);
    HKEY hk;
    if(::RegOpenKeyEx (h,(LPTSTR)name,0,KEY_READ,&hk) == ERROR_SUCCESS)
    {
    strcpy(data_set,"");
    strcpy(strkey,sKey);
    strcat(strkey,"\\");
    strcat(strkey,name);
    EnumKey(hk,strkey);
    ::RegCloseKey (hk);
    }
    dwIndex += 1;
    namelen = sizeof(name); //must be specified every time!!!
    }
    ::RegCloseKey (hKey);

    }void main()
    {
    printf("Enum all reg keys and values\n");
    time_t start,end;
    time(&start);
    for(int i = 0 ; i < 5; i++)
    {
    strcpy(data_set,"");
    EnumKey(hKey[i],sKey[i]);
    }
    time(&end);
    printf("altogether %ld keys!!!\n",nCount);
    printf("using time : %ld seconds!\n",end - start );}
    *****************************************************************