--- /dev/null
+
\ No newline at end of file
WinMute
- Copyright (C) 2020 Alexander Steinhoefer
+ Copyright (C) 2021 Alexander Steinhoefer
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
</head>
<body>
<h1>WinMute 1.6.0</h1>
- <p class="copyright">© Copyright 2020, Alexander Steinhöfer - <a href="http://www.lx-s.de">www.lx-s.de</a></p>
+ <p class="copyright">© Copyright 2021, Alexander Steinhöfer - <a href="http://www.lx-s.de">www.lx-s.de</a></p>
<h2>Über</h2>
<p>WinMute kann Windows automatisch stumm schalten, sobald</p>
</head>
<body>
<h1>WinMute 1.6.0</h1>
- <p class="copyright">© Copyright 2020, by Alexander Steinhöfer - <a href="http://www.lx-s.de">www.lx-s.de</a></p>
+ <p class="copyright">© Copyright 2021, by Alexander Steinhöfer - <a href="http://www.lx-s.de">www.lx-s.de</a></p>
<h2>About</h2>
<p>WinMute can automatically mute your volume when</p>
/*
ScreensaverNotify DLL
- Copyright (c) 2020, Alexander Steinhoefer
+ Copyright (c) 2021, Alexander Steinhoefer
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
<TreatWarningAsError>true</TreatWarningAsError>
<EnablePREfast>true</EnablePREfast>
<DiagnosticsFormat>Caret</DiagnosticsFormat>
+ <LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<TreatWarningAsError>true</TreatWarningAsError>
<EnablePREfast>true</EnablePREfast>
<DiagnosticsFormat>Caret</DiagnosticsFormat>
+ <LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<TreatWarningAsError>true</TreatWarningAsError>
<EnablePREfast>true</EnablePREfast>
<DiagnosticsFormat>Caret</DiagnosticsFormat>
+ <LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<TreatWarningAsError>true</TreatWarningAsError>
<EnablePREfast>true</EnablePREfast>
<DiagnosticsFormat>Caret</DiagnosticsFormat>
+ <LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<PreprocessorDefinitions>WINMUTEDLL_EXPORTS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<DiagnosticsFormat>Caret</DiagnosticsFormat>
+ <LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<PreprocessorDefinitions>WINMUTEDLL_EXPORTS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<DiagnosticsFormat>Caret</DiagnosticsFormat>
+ <LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<PreprocessorDefinitions>WINMUTEDLL_EXPORTS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<DiagnosticsFormat>Caret</DiagnosticsFormat>
+ <LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<PreprocessorDefinitions>WINMUTEDLL_EXPORTS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<DiagnosticsFormat>Caret</DiagnosticsFormat>
+ <LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
/*
WinMute
- Copyright (c) 2020, Alexander Steinhoefer
+ Copyright (c) 2021, Alexander Steinhoefer
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
/*
WinMute
- Copyright (c) 2020, Alexander Steinhoefer
+ Copyright (c) 2021, Alexander Steinhoefer
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
/*
WinMute
- Copyright (c) 2020, Alexander Steinhoefer
+ Copyright (c) 2021, Alexander Steinhoefer
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
+ <LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
+ <LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
+ <LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
+ <LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
/*
WinMute
- Copyright (c) 2020, Alexander Steinhoefer
+ Copyright (c) 2021, Alexander Steinhoefer
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
--- /dev/null
+/*
+ WinMute
+ Copyright (c) 2021, Alexander Steinhoefer
+
+-----------------------------------------------------------------------------
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of the author nor the names of its contributors may
+ be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+-----------------------------------------------------------------------------
+*/
+
+#pragma once
+
+#include "StdAfx.h"
+
+static bool OpenLogFile(std::ofstream &logFile)
+{
+ auto path = std::filesystem::temp_directory_path();
+ path /= "WinMute.log";
+ logFile.open(path.string(), std::ios::out|std::ios::app|std::ios::binary);
+ return logFile.is_open();
+}
+
+Log& Log::GetInstance()
+{
+ static Log log;
+ return log;
+}
+
+Log::Log():
+ initialized_(false)
+{
+ if (OpenLogFile(logFile_)) {
+ initialized_ = true;
+ }
+}
+
+Log::~Log()
+{
+ if (initialized_) {
+ logFile_.close();
+ }
+}
+
+void Log::Write(std::string msg)
+{
+ if (!initialized_) {
+ return;
+ }
+ auto now = std::chrono::system_clock::now();
+ auto in_time_t = std::chrono::system_clock::to_time_t(now);
+ struct tm tm;
+
+ std::stringstream ss;
+ localtime_s(&tm, &in_time_t);
+ ss << "[" << std::put_time(&tm, "%Y-%m-%d %X") << "] ";
+ ss << msg;
+ ss << "\n";
+
+ logFile_.write(ss.str().c_str(), ss.str().length());
+}
--- /dev/null
+/*
+ WinMute
+ Copyright (c) 2021, Alexander Steinhoefer
+
+-----------------------------------------------------------------------------
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of the author nor the names of its contributors may
+ be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+-----------------------------------------------------------------------------
+*/
+
+#pragma once
+
+#include "StdAfx.h"
+
+class Log {
+public:
+ Log& GetInstance();
+ void Write(std::string msg);
+private:
+ Log();
+ ~Log();
+ Log(const Log&) = delete;
+ Log& operator=(const Log&) = delete;
+
+ bool initialized_;
+ std::ofstream logFile_;
+};
/*
WinMute
- Copyright (c) 2020, Alexander Steinhoefer
+ Copyright (c) 2021, Alexander Steinhoefer
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
/*
WinMute
- Copyright (c) 2020, Alexander Steinhoefer
+ Copyright (c) 2021, Alexander Steinhoefer
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
/*
WinMute
- Copyright (c) 2020, Alexander Steinhoefer
+ Copyright (c) 2021, Alexander Steinhoefer
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
/*
WinMute
- Copyright (c) 2020, Alexander Steinhoefer
+ Copyright (c) 2021, Alexander Steinhoefer
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
/*
WinMute
- Copyright (c) 2020, Alexander Steinhoefer
+ Copyright (c) 2021, Alexander Steinhoefer
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
/*
WinMute
- Copyright (c) 2020, Alexander Steinhoefer
+ Copyright (c) 2021, Alexander Steinhoefer
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
/*
WinMute
- Copyright (c) 2020, Alexander Steinhoefer
+ Copyright (c) 2021, Alexander Steinhoefer
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
/* WinMute
- Copyright (c) 2020, Alexander Steinhoefer
+ Copyright (c) 2021, Alexander Steinhoefer
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
/*
WinMute
- Copyright (c) 2020, Alexander Steinhoefer
+ Copyright (c) 2021, Alexander Steinhoefer
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
#include <memory>
#include <vector>
#include <algorithm>
+#include <fstream>
+#include <filesystem>
+#include <chrono>
#include <windows.h>
#include <windowsx.h>
#include "ScreensaverNotifier.h"
#include "Settings.h"
+#include "Log.h"
#include "TrayIcon.h"
#include "WinMute.h"
#include "VersionHelper.h"
/*
WinMute
- Copyright (c) 2020, Alexander Steinhoefer
+ Copyright (c) 2021, Alexander Steinhoefer
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
/*
WinMute
- Copyright (c) 2020, Alexander Steinhoefer
+ Copyright (c) 2021, Alexander Steinhoefer
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
/*
WinMute
- Copyright (c) 2020, Alexander Steinhoefer
+ Copyright (c) 2021, Alexander Steinhoefer
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
/*
WinMute
- Copyright (c) 2020, Alexander Steinhoefer
+ Copyright (c) 2021, Alexander Steinhoefer
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
/*
WinMute
- Copyright (c) 2020, Alexander Steinhoefer
+ Copyright (c) 2021, Alexander Steinhoefer
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
/*
WinMute
- Copyright (c) 2020, Alexander Steinhoefer
+ Copyright (c) 2021, Alexander Steinhoefer
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
/*
WinMute
- Copyright (c) 2020, Alexander Steinhoefer
+ Copyright (c) 2021, Alexander Steinhoefer
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
/*
WinMute
- Copyright (c) 2020, Alexander Steinhoefer
+ Copyright (c) 2021, Alexander Steinhoefer
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
/*
WinMute
- Copyright (c) 2020, Alexander Steinhoefer
+ Copyright (c) 2021, Alexander Steinhoefer
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
/*
WinMute
- Copyright (c) 2020, Alexander Steinhoefer
+ Copyright (c) 2021, Alexander Steinhoefer
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
/*
WinMute
- Copyright (c) 2020, Alexander Steinhoefer
+ Copyright (c) 2021, Alexander Steinhoefer
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
<SDLCheck>true</SDLCheck>
<EnablePREfast>true</EnablePREfast>
<DiagnosticsFormat>Caret</DiagnosticsFormat>
+ <LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<AdditionalDependencies>strsafe.lib;comctl32.lib;WtsApi32.lib;Winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
<EnablePREfast>true</EnablePREfast>
<DiagnosticsFormat>Caret</DiagnosticsFormat>
<SDLCheck>true</SDLCheck>
+ <LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<AdditionalDependencies>strsafe.lib;comctl32.lib;WtsApi32.lib;Winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
<DiagnosticsFormat>Caret</DiagnosticsFormat>
<ControlFlowGuard>Guard</ControlFlowGuard>
<OmitFramePointers />
+ <LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<AdditionalDependencies>strsafe.lib;comctl32.lib;WtsApi32.lib;Winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SDLCheck>true</SDLCheck>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ControlFlowGuard>Guard</ControlFlowGuard>
+ <LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<AdditionalDependencies>strsafe.lib;comctl32.lib;WtsApi32.lib;Winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="AboutDlg.cpp" />
+ <ClCompile Include="Log.cpp" />
<ClCompile Include="MMNotificationClient.cpp" />
<ClCompile Include="QuietHoursDlg.cpp" />
<ClCompile Include="ScreensaverNotifier.cpp" />
<ClCompile Include="WinMute.cpp" />
</ItemGroup>
<ItemGroup>
+ <ClInclude Include="Log.h" />
<ClInclude Include="MMNotificationClient.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="ScreensaverNotifier.h" />
<Filter Include="Source Files\Settings">
<UniqueIdentifier>{f9c118fc-0a72-4278-a710-841604aeb3e3}</UniqueIdentifier>
</Filter>
+ <Filter Include="Source Files\Log">
+ <UniqueIdentifier>{dc591c83-7135-4757-b9cb-54405dbc8d86}</UniqueIdentifier>
+ </Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="StdAfx.cpp">
<ClCompile Include="QuietHoursDlg.cpp">
<Filter>Source Files\UI</Filter>
</ClCompile>
+ <ClCompile Include="Log.cpp">
+ <Filter>Source Files\Log</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="resource.h">
<ClInclude Include="Settings.h">
<Filter>Source Files\Settings</Filter>
</ClInclude>
+ <ClInclude Include="Log.h">
+ <Filter>Source Files\Log</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="app.ico">
VALUE "FileDescription", "WinMute"
VALUE "FileVersion", "1.6.0.0"
VALUE "InternalName", "WinMute"
- VALUE "LegalCopyright", "Copyright (c) 2020, Alexander Steinhöfer"
+ VALUE "LegalCopyright", "Copyright (c) 2021, Alexander Steinhöfer"
VALUE "OriginalFilename", "WinMute.exe"
VALUE "ProductName", "WinMute"
VALUE "ProductVersion", "1.6.0.0"
VALUE "FileDescription", "WinMute"
VALUE "FileVersion", "1.6.0.0"
VALUE "InternalName", "WinMute"
- VALUE "LegalCopyright", "Copyright (c) 2020, Alexander Steinhöfer"
+ VALUE "LegalCopyright", "Copyright (c) 2021, Alexander Steinhöfer"
VALUE "OriginalFilename", "WinMute.exe"
VALUE "ProductName", "WinMute"
VALUE "ProductVersion", "1.6.0.0"