]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/registry.cpp
* Stream doc update.
[wxWidgets.git] / src / msw / registry.cpp
index bb51ed0337cc0087027fd68a087a029ea709c2e1..9ab127dd6739431553cf0b3040c6e0f87f0c8c8c 100644 (file)
 #include  "wx/string.h"
 #include  "wx/intl.h"
 #include  "wx/log.h"
-
 #include  "wx/config.h"    // for wxExpandEnvVars
 
+#ifndef __WIN16__
+
 // Windows headers
 /*
 #define   STRICT
@@ -313,7 +314,7 @@ bool wxRegKey::GetKeyInfo(ulong *pnSubKeys,
                           ulong *pnMaxValueLen) const
 #endif
 {
-#ifdef  __WIN32__
+#if defined(__WIN32__) && !defined(__TWIN32__)
   m_dwLastError = ::RegQueryInfoKey
                   (
                     (HKEY) m_hKey,
@@ -473,7 +474,7 @@ bool wxRegKey::DeleteValue(const char *szValue)
   if ( !Open() )
     return FALSE;
 
-  #ifdef  __WIN32__
+#if defined(__WIN32__) && !defined(__TWIN32__)
     m_dwLastError = RegDeleteValue((HKEY) m_hKey, (char*) (const char*) szValue);
     if ( m_dwLastError != ERROR_SUCCESS ) {
       wxLogSysError(m_dwLastError, _("can't delete value '%s' from key '%s'"),
@@ -543,10 +544,10 @@ bool wxRegKey::HasSubKey(const char *szKey) const
     return FALSE;
 }
 
-wxRegKey::ValueType wxRegKey::GetValueType(const char *szValue)
+wxRegKey::ValueType wxRegKey::GetValueType(const char *szValue) const
 {
   #ifdef  __WIN32__
-    if ( !Open() )
+    if ( ! CONST_CAST Open() )
       return Type_None;
 
     DWORD dwType;
@@ -567,6 +568,10 @@ wxRegKey::ValueType wxRegKey::GetValueType(const char *szValue)
 #ifdef  __WIN32__
 bool wxRegKey::SetValue(const char *szValue, long lValue)
 {
+#ifdef __TWIN32__
+  wxFAIL_MSG("RegSetValueEx not implemented by TWIN32");
+  return FALSE;
+#else
   if ( CONST_CAST Open() ) {
     m_dwLastError = RegSetValueEx((HKEY) m_hKey, szValue, (DWORD) RESERVED, REG_DWORD,
                                   (RegString)&lValue, sizeof(lValue));
@@ -577,6 +582,7 @@ bool wxRegKey::SetValue(const char *szValue, long lValue)
   wxLogSysError(m_dwLastError, _("can't set value of '%s'"),
                 GetFullName(this, szValue));
   return FALSE;
+#endif
 }
 
 bool wxRegKey::QueryValue(const char *szValue, long *plValue) const
@@ -645,7 +651,7 @@ bool wxRegKey::QueryValue(const char *szValue, wxString& strValue) const
 bool wxRegKey::SetValue(const char *szValue, const wxString& strValue)
 {
   if ( CONST_CAST Open() ) {
-    #ifdef  __WIN32__
+#if defined( __WIN32__) && !defined(__TWIN32__)
       m_dwLastError = RegSetValueEx((HKEY) m_hKey, szValue, (DWORD) RESERVED, REG_SZ,
                                     (RegString)strValue.c_str(), 
                                     strValue.Len() + 1);
@@ -696,7 +702,7 @@ bool wxRegKey::GetNextValue(wxString& strValueName, long& lIndex) const
   if ( lIndex == -1 )
     return FALSE;
 
-  #ifdef  __WIN32__
+#if defined( __WIN32__) && !defined(__TWIN32__)
     char  szValueName[1024];                  // @@ use RegQueryInfoKey...
     DWORD dwValueLen = WXSIZEOF(szValueName);
 
@@ -799,3 +805,7 @@ void RemoveTrailingSeparator(wxString& str)
   if ( !str.IsEmpty() && str.Last() == REG_SEPARATOR )
     str.Truncate(str.Len() - 1);
 }
+
+#endif
+  // __WIN16__
+