diff --git a/Application/Application.rc b/Application/Application.rc index 75b4330a..954c699f 100644 --- a/Application/Application.rc +++ b/Application/Application.rc @@ -28,8 +28,8 @@ LANGUAGE LANG_FINNISH, SUBLANG_DEFAULT // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,3,0,482 - PRODUCTVERSION 1,3,0,482 + FILEVERSION 1,3,0,502 + PRODUCTVERSION 1,3,0,502 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -45,12 +45,12 @@ BEGIN BLOCK "040b04b0" BEGIN VALUE "FileDescription", "Rainmeter - A Customizable Resource Meter" - VALUE "FileVersion", "1, 3, 0, 482" + VALUE "FileVersion", "1, 3, 0, 502" VALUE "InternalName", "Rainmeter" VALUE "LegalCopyright", "Copyright (C) 2010 - Rainy" VALUE "OriginalFilename", "Rainmeter.exe" VALUE "ProductName", "Rainmeter" - VALUE "ProductVersion", "1, 3, 0, 482" + VALUE "ProductVersion", "1, 3, 0, 502" END END BLOCK "VarFileInfo" diff --git a/Plugins/PluginMediaKey/PluginMediaKey.cpp b/Plugins/PluginMediaKey/PluginMediaKey.cpp new file mode 100644 index 00000000..b74c1dd7 --- /dev/null +++ b/Plugins/PluginMediaKey/PluginMediaKey.cpp @@ -0,0 +1,106 @@ +/* + Copyright (C) 2010 poiru + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include +#include +#include "..\..\Library\Export.h" // Rainmeter's exported functions + +/* The exported functions */ +extern "C" +{ +__declspec( dllexport ) UINT Update(UINT id); +__declspec( dllexport ) UINT GetPluginVersion(); +__declspec( dllexport ) LPCTSTR GetPluginAuthor(); +__declspec( dllexport ) void ExecuteBang(LPCTSTR args, UINT id); +} + +void SendKey(WORD key); + +/* + This function is called when new value should be measured. + The function returns the new value. +*/ +UINT Update(UINT id) +{ + return 0; +} + +void SendKey(WORD key) +{ + KEYBDINPUT kbi; + kbi.wVk = key; // Provide your own + kbi.wScan = 0; + kbi.dwFlags = 0; // See docs for flags (mm keys may need Extended key flag) + kbi.time = 0; + kbi.dwExtraInfo = (ULONG_PTR) GetMessageExtraInfo(); + + INPUT input; + input.type = INPUT_KEYBOARD; + input.ki = kbi; + + SendInput(1, &input, sizeof(INPUT)); +} + +void ExecuteBang(LPCTSTR args, UINT id) +{ + std::wstring wholeBang = args; + + size_t pos = wholeBang.find(' '); + if (_wcsicmp(wholeBang.c_str(), L"NextTrack") == 0) + { + SendKey(VK_MEDIA_NEXT_TRACK); + } + else if (_wcsicmp(wholeBang.c_str(), L"PrevTrack") == 0) + { + SendKey(VK_MEDIA_PREV_TRACK); + } + else if (_wcsicmp(wholeBang.c_str(), L"Stop") == 0) + { + SendKey(VK_MEDIA_STOP); + } + else if (_wcsicmp(wholeBang.c_str(), L"PlayPause") == 0) + { + SendKey(VK_MEDIA_PLAY_PAUSE); + } + else if (_wcsicmp(wholeBang.c_str(), L"VolumeMute") == 0) + { + SendKey(VK_VOLUME_MUTE); + } + else if (_wcsicmp(wholeBang.c_str(), L"VolumeDown") == 0) + { + SendKey(VK_VOLUME_DOWN); + } + else if (_wcsicmp(wholeBang.c_str(), L"VolumeUp") == 0) + { + SendKey(VK_VOLUME_UP); + } + else + { + LSLog(LOG_DEBUG, L"Rainmeter", L"MediaKeyPlugin: Unknown bang!"); + } +} + +UINT GetPluginVersion() +{ + return 1000; +} + +LPCTSTR GetPluginAuthor() +{ + return L"poiru"; +} \ No newline at end of file diff --git a/Plugins/PluginMediaKey/PluginMediaKey.vcproj b/Plugins/PluginMediaKey/PluginMediaKey.vcproj new file mode 100644 index 00000000..327120ca --- /dev/null +++ b/Plugins/PluginMediaKey/PluginMediaKey.vcproj @@ -0,0 +1,634 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Rainmeter.sln b/Rainmeter.sln index 32cc4e3d..d4db5dca 100644 --- a/Rainmeter.sln +++ b/Rainmeter.sln @@ -97,6 +97,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PluginVirtualDesktops", "Pl {BE9D2400-7F1C-49D6-8498-5CE495491AD6} = {BE9D2400-7F1C-49D6-8498-5CE495491AD6} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PluginMediaKey", "Plugins\PluginMediaKey\PluginMediaKey.vcproj", "{EB48A04A-657E-41B8-B2F5-D47F8C30B2B4}" + ProjectSection(ProjectDependencies) = postProject + {BE9D2400-7F1C-49D6-8498-5CE495491AD6} = {BE9D2400-7F1C-49D6-8498-5CE495491AD6} + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -313,6 +318,18 @@ Global {4640AB3A-5A8B-2DA0-980C-A70BCAB3A7F1}.Release64|Win32.Build.0 = Release64|Win32 {4640AB3A-5A8B-2DA0-980C-A70BCAB3A7F1}.Release64|x64.ActiveCfg = Release64|x64 {4640AB3A-5A8B-2DA0-980C-A70BCAB3A7F1}.Release64|x64.Build.0 = Release64|x64 + {EB48A04A-657E-41B8-B2F5-D47F8C30B2B4}.Debug|Win32.ActiveCfg = Debug|Win32 + {EB48A04A-657E-41B8-B2F5-D47F8C30B2B4}.Debug|Win32.Build.0 = Debug|Win32 + {EB48A04A-657E-41B8-B2F5-D47F8C30B2B4}.Debug|x64.ActiveCfg = Debug|x64 + {EB48A04A-657E-41B8-B2F5-D47F8C30B2B4}.Debug|x64.Build.0 = Debug|x64 + {EB48A04A-657E-41B8-B2F5-D47F8C30B2B4}.Release|Win32.ActiveCfg = Release|Win32 + {EB48A04A-657E-41B8-B2F5-D47F8C30B2B4}.Release|Win32.Build.0 = Release|Win32 + {EB48A04A-657E-41B8-B2F5-D47F8C30B2B4}.Release|x64.ActiveCfg = Release|x64 + {EB48A04A-657E-41B8-B2F5-D47F8C30B2B4}.Release|x64.Build.0 = Release|x64 + {EB48A04A-657E-41B8-B2F5-D47F8C30B2B4}.Release64|Win32.ActiveCfg = Release64|Win32 + {EB48A04A-657E-41B8-B2F5-D47F8C30B2B4}.Release64|Win32.Build.0 = Release64|Win32 + {EB48A04A-657E-41B8-B2F5-D47F8C30B2B4}.Release64|x64.ActiveCfg = Release64|x64 + {EB48A04A-657E-41B8-B2F5-D47F8C30B2B4}.Release64|x64.Build.0 = Release64|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/revision-number.h b/revision-number.h index a8ac538a..e8ebbe10 100644 --- a/revision-number.h +++ b/revision-number.h @@ -1,3 +1,3 @@ #pragma once -const int revision_number = 482; +const int revision_number = 502; const bool revision_beta = true; \ No newline at end of file