zephyrer / advcombobox

Automatically exported from code.google.com/p/advcombobox
0 stars 0 forks source link

WinXP and Classic Theme selection #19

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
http://www.codeproject.com/Messages/1163911/WinXP-and-Classic-Theme-selection.as
px

Hi,

if you select classic under xp theme selection the buttons of the combobox are 
not drawn.

I have changed "UseVisualStyles()" in the following way:

BOOL CVisualStylesXP::UseVisualStyles()
{
     static BOOL bUse = -1;
     if( bUse != -1 )
          return bUse;

     HINSTANCE hinstDll;
     DLLVERSIONINFO dvi;
     ZeroMemory(&dvi, sizeof(dvi));

     hinstDll = LoadLibrary(TEXT("comctl32.dll"));
     if(hinstDll)
     {
          DLLGETVERSIONPROC pDllGetVersion;
          pDllGetVersion = (DLLGETVERSIONPROC) GetProcAddress(hinstDll, "DllGetVersion");
          if(pDllGetVersion)
          {
               ZeroMemory(&dvi, sizeof(dvi));
               dvi.cbSize = sizeof(dvi);
               (*pDllGetVersion)(&dvi);
          }
          FreeLibrary(hinstDll);
     }

     if( dvi.dwMajorVersion == 6 && dvi.dwMinorVersion == 0 )
     {
      WCHAR szName [256];
      WCHAR szColor [256];

      if(!GetCurrentThemeName(szName, 255, szColor, 255, NULL, 0))
      {
         CString strWinXPThemeColor = szColor;
         if(strWinXPThemeColor.CompareNoCase (_T("normalcolor")) == 0 ||
               strWinXPThemeColor.CompareNoCase (_T("homestead")) == 0 ||
            strWinXPThemeColor.CompareNoCase (_T("metallic")) == 0)
         {
                bUse = TRUE;
                return IsAppThemed() && m_hThemeDll; // No need to test HTHEME, but...
         }
      }
      bUse = FALSE;
      return FALSE;
     }
     else
     {
          bUse = FALSE;
          return FALSE;
     }
}

Original issue reported on code.google.com by mathias....@gmail.com on 29 Sep 2010 at 9:32

GoogleCodeExporter commented 9 years ago

Original comment by mathias....@gmail.com on 29 Sep 2010 at 7:12