====== GetRegistryDWord() ====== Consider the following VO function: function RegistryDWord( hKey as ptr, cSubKey as string, cValueName as string ) as int pascal local ptrKey as ptr local nData as int local nResult as long local nLen as dword nResult := RegOpenKeyEx( hKey, String2Psz( cSubKey ), 0, KEY_QUERY_VALUE, @ptrKey ) if nResult == ERROR_SUCCESS nLen := 4 nResult := RegQueryValueEx( ptrKey, String2Psz( cValueName ), null_ptr, null_ptr, @nData, @nLen ) if nResult != ERROR_SUCCESS nData := -1 endif RegCloseKey( ptrKey ) endif return nData In X# it can be changed to function RegistryDWord( hKey as ptr, cSubKey as string, cValueName as string ) as int pascal local nData as int if ! Left( cSubKey, 1 ) == "\" cSubKey := "\" + cSubKey endif do case case hKey == HKEY_CLASSES_ROOT cSubKey := "HKEY_CLASSES_ROOT" + cSubKey case hKey == HKEY_CURRENT_USER cSubKey := "HKEY_CURRENT_USER" + cSubKey case hKey == HKEY_LOCAL_MACHINE cSubKey := "HKEY_LOCAL_MACHINE" + cSubKey case hKey == HKEY_USERS cSubKey := "HKEY_USERS" + cSubKey endcase nData := ( int ) GetRegistryValue( cSubKey, cValueName, 0 ) return nData