update for HEAD-2003091401
[reactos.git] / subsys / system / explorer / Seashell / SeaShellExt / ShellSettings.cpp
1 //*******************************************************************************
2 // COPYRIGHT NOTES
3 // ---------------
4 // You may use this source code, compile or redistribute it as part of your application 
5 // for free. You cannot redistribute it as a part of a software development 
6 // library without the agreement of the author. If the sources are 
7 // distributed along with the application, you should leave the original 
8 // copyright notes in the source code without any changes.
9 // This code can be used WITHOUT ANY WARRANTIES at your own risk.
10 // 
11 // For the latest updates to this code, check this site:
12 // http://www.masmex.com 
13 // after Sept 2000
14 // 
15 // Copyright(C) 2000 Philip Oldaker <email: philip@masmex.com>
16 //*******************************************************************************
17
18 #include "stdafx.h"
19 #include "ShellSettings.h"
20
21 typedef void (WINAPI *PFNSHGETSETTINGSPROC)(LPSHELLFLAGSTATE lpsfs, DWORD dwMask);  
22
23 CShellSettings::CShellSettings()
24 {
25         // Since SHGetSettings is not implemented in all versions of the shell, 
26         // get the function address manually at run time. 
27         // This allows the extension to run on all platforms. 
28         m_hinstShell32 = LoadLibrary(TEXT("shell32.dll")); 
29         ZeroMemory(&m_sfs, sizeof(m_sfs));  
30         // The default is classic Windows 95 style. 
31         m_sfs.fWin95Classic = TRUE; 
32 }
33
34 CShellSettings::~CShellSettings()
35 {
36         if (m_hinstShell32) 
37                 FreeLibrary(m_hinstShell32);  
38 }
39
40 bool CShellSettings::GetSettings() 
41 {
42         if (m_hinstShell32 == NULL) 
43                  return false;
44         PFNSHGETSETTINGSPROC pfnSHGetSettings; 
45         pfnSHGetSettings = (PFNSHGETSETTINGSPROC)GetProcAddress(m_hinstShell32, "SHGetSettings"); 
46         if(pfnSHGetSettings) 
47         {   
48                 ZeroMemory(&m_sfs, sizeof(m_sfs));  
49                  (*pfnSHGetSettings)(&m_sfs, 
50                         SSF_DESKTOPHTML |                       // The fDesktopHTML member is being requested.  
51                         SSF_DONTPRETTYPATH |            // The fDontPrettyPath member is being requested.  
52                         SSF_DOUBLECLICKINWEBVIEW |  // The fDoubleClickInWebView member is being requested.  
53                         SSF_HIDEICONS |                         // The fHideIcons member is being requested.  
54                         SSF_MAPNETDRVBUTTON |           // The fMapNetDrvBtn member is being requested.  
55                         SSF_NOCONFIRMRECYCLE |          // The fNoConfirmRecycle member is being requested.  
56                         SSF_SHOWALLOBJECTS |            // The fShowAllObjects member is being requested.  
57                         SSF_SHOWATTRIBCOL |                     // The fShowAttribCol member is being requested.  
58                         SSF_SHOWCOMPCOLOR |                     // The fShowCompColor member is being requested.  
59                         SSF_SHOWEXTENSIONS |            // The fShowExtensions member is being requested.  
60                         SSF_SHOWINFOTIP |                       // The fShowInfoTip member is being requested.  
61                         SSF_SHOWSYSFILES |                      // The fShowSysFiles member is being requested.  
62                         SSF_WIN95CLASSIC);                      // The fWin95Classic member is being requested.  
63         }  
64         return true;
65 }