首先,c中"\"要用"\\"来表示.
使用API是不要加上什么东西.
你现在的错是类型错误,你应该查一下MSDN,hRegSubKey既然是以h开头,就应该是handle,不会是int类型的.还有,61行的东西你没有给出把??

解决方案 »

  1.   

    谢谢各位。 HKEY hRegMainKey=HKEY_LOCAL_MACHINE;
    HKEY hRegSubKey; 
    LPBYTE pStrUninstallPath;
    if (!RegOpenKeyEx(hRegMainKey,"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Bio3",0,KEY_READ,&hRegSubKey))
    {
    RegQueryValueEx(hRegSubKey,"UninstallString",NULL,REG_SZ,pStrUninstallPath,256);
    RegCloseKey(hRegSubKey);
    }可是还是提示错误:
    F:\PROJECT\BIO3Fixer\BIO3FixerDlg.cpp(64) : error C2664: 'RegQueryValueExA' : cannot convert parameter 4 from 'const int' to 'unsigned long *'
            Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast64行是函数那行。
    好像是传递REG_SZ的时候错误。
    再次谢谢。
      

  2.   

    LONG RegQueryValueEx(
      HKEY hKey,           // handle to key to query
      LPTSTR lpValueName,  // address of name of value to query
      LPDWORD lpReserved,  // reserved
      LPDWORD lpType,      // address of buffer for value type
      LPBYTE lpData,       // address of data buffer
      LPDWORD lpcbData     // address of data buffer size
    );
     
    最后一个参数是指针,你传数字当然错误了
      

  3.   

    DWORD cbData, dwType ;
    TCHAR szPath[MAX_PATH] ;
    RegQueryValueEx(hRegSubKey,"UninstallString",NULL,&dwType,(LPBYTE)szPath,&cbData);用MFC中的类 CRegKey 更方便一点