1 //*******************************************************************************
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.
11 // For the latest updates to this code, check this site:
12 // http://www.masmex.com
15 // Copyright(C) 2000 Philip Oldaker <email: philip@masmex.com>
16 //*******************************************************************************
19 #include "ShellSettings.h"
21 typedef void (WINAPI *PFNSHGETSETTINGSPROC)(LPSHELLFLAGSTATE lpsfs, DWORD dwMask);
23 CShellSettings::CShellSettings()
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;
34 CShellSettings::~CShellSettings()
37 FreeLibrary(m_hinstShell32);
40 bool CShellSettings::GetSettings()
42 if (m_hinstShell32 == NULL)
44 PFNSHGETSETTINGSPROC pfnSHGetSettings;
45 pfnSHGetSettings = (PFNSHGETSETTINGSPROC)GetProcAddress(m_hinstShell32, "SHGetSettings");
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.