var
str:string;
begin
RegQueryValue(HKEY_LOCAL_MACHINE,'SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon',pchar(str),length(pchar(str))+1);編譯不過,顯示為:[Error] Unit1.pas(133): Types of actual and formal var parameters must be identical,請問如何解決?

解决方案 »

  1.   

    LONG RegQueryValue(    HKEY hKey, // handle of key to query 
        LPCTSTR lpSubKey, // address of name of subkey to query 
        LPTSTR lpValue, // address of buffer for returned string 
        PLONG lpcbValue  // address of buffer for size of returned string 
       );
      

  2.   

    LONG RegQueryValue(
        HKEY hKey,// handle of key to query 
        LPCTSTR lpSubKey,// address of name of subkey to query 
        LPTSTR lpValue,// address of buffer for returned string 
        PLONG lpcbValue // address of buffer for size of returned string 
       );最后一个参数也是指针,指向一个Long(DWORD)类型的缓冲区。你改为这样试试
    var
    str:string;
    dwStr: DWORD;
    begin
    RegQueryValue(HKEY_LOCAL_MACHINE,'SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon',pchar(str),&dwStr);推荐使用RegQueryValueEx这个API。
      

  3.   

    編譯時提示'Illegal character in input file: '&' [$26]
    RegQueryValueEx該怎麼用?謝謝.