在注册表里,Acrobat Reader [HKEY_CURRENT_USER\Software\Adobe\Acrobat Reader\4.0\AdobeViewer] "avpRecentFile1" 是"d:\book\***.pdf",如何取得这个路径"d:\book\***.pdf"?
最好有部分代码,谢谢

解决方案 »

  1.   

    API函数SHGetValue DWORD dwErr,dwType;
    char cBuffer[1024];
    CString strPath;
    DWORD len;
             CString strResult; strPath="Software\Adobe\Acrobat Reader\4.0\AdobeViewer";
    dwType=REG_SZ;
    len=sizeof(cBuffer);
    dwErr=::SHGetValue(
    HKEY_CURRENT_USER
    ,(LPCSTR)strPath
    ,"avpRecentFile1"
    ,&dwType
    ,&cBuffer
    ,&len
    );
    if (dwErr!=ERROR_SUCCESS)
    {
    strResult="default";
    }
    else
    {
    strResult=cBuffer;
    }
      

  2.   

    自己找一下msdn,里面有API函数,很简单的
      

  3.   

    char lpSubKey[MAX_PATH];
    char netentry[5];
    // int i;
    HKEY OpenedKey;
    LONG Status;
    DWORD index = 0;
    char pName[MAX_PATH];
    DWORD NameSize = MAX_PATH;
    DWORD Type;
    BYTE pData[MAX_PATH];
    DWORD DataSize = MAX_PATH;
    BOOL CardIsPCMCIA = FALSE; if(!W32N_IsWindows95())
    return FALSE; strcpy(lpSubKey, W32N_REGSTR_PATH_CLASS_NET);
    sprintf(netentry, "\\%s",AdapterName);
    strcat(lpSubKey, netentry); Status = RegOpenKeyEx( HKEY_LOCAL_MACHINE, // handle of open key
    lpSubKey,         // address of name of subkey to open
         0,         // reserved
    KEY_ALL_ACCESS,         // security access mask
    &OpenedKey );         // address of handle of open key
    if(Status == 0)
    {
    index = 0; do{
    Status = RegEnumValue( OpenedKey, // handle of key to query
    index, // index of value to query
    pName, // buffer for the name of value for this index
    &NameSize, // size of value buffer
    NULL, // reserved
    &Type, // type of data
    pData, // address of buffer for value data
    &DataSize); // address for size of data buffer if(Status == 0)
    if(Type == REG_SZ)
    {
    if(!strcmp(pName, "MatchingDeviceId"))
    {
    if(!strncmp((const char *)pData, "PCMCIA", 6))
    {
    m_MatchingDeviceID = pData+7;//cut PCMCIA
    CardIsPCMCIA = TRUE;
    break;
    }
    }
    }
    index++;
    NameSize = MAX_PATH;
    DataSize = MAX_PATH;
    }while(Status == 0);

    }
    RegCloseKey(OpenedKey); return CardIsPCMCIA;
      

  4.   

    http://www.csdn.net/expert/topic/916/916130.xml?temp=.7031671
      

  5.   

    char szRecentFile1[MAX_PATH];
           dwBufLen = MAX_PATH; nRetCode = ::RegOpenKeyEx(HKEY_CURRENT_USER,
     "Software\Adobe\Acrobat Reader\4.0\AdobeViewer",
     0,
     KEY_ALL_ACCESS,
     &hKey
     );

    if (nRetCode != ERROR_SUCCESS)
    return false;

    nRetCode = ::RegQueryValueEx(hKey,
     "avpRecentFile1",
     NULL,
     NULL,
     (LPBYTE)szRecentFile1,
     &dwBufLen
     );

    if (nRetCode != ERROR_SUCCESS)
    return false;