├── .github └── workflows │ └── build.yml ├── .gitignore ├── API ├── DllExporter.exe ├── RainmeterAPI.cs ├── RainmeterAPI.h ├── x32 │ └── Rainmeter.lib └── x64 │ └── Rainmeter.lib ├── C# ├── PluginDataHandling │ ├── AssemblyInfo.cs │ ├── PluginDataHandling.cs │ └── PluginDataHandling.csproj ├── PluginEmpty │ ├── AssemblyInfo.cs │ ├── PluginEmpty.cs │ └── PluginEmpty.csproj ├── PluginParentChild │ ├── AssemblyInfo.cs │ ├── PluginParentChild.cs │ └── PluginParentChild.csproj ├── PluginRmExecute │ ├── AssemblyInfo.cs │ ├── PluginRmExecute.cs │ └── PluginRmExecute.csproj ├── PluginSectionVariables │ ├── AssemblyInfo.cs │ ├── PluginSectionVariables.cs │ └── PluginSectionVariables.csproj ├── PluginSystemVersion │ ├── AssemblyInfo.cs │ ├── PluginSystemVersion.cs │ └── PluginSystemVersion.csproj └── SDK-CS.sln ├── C++ ├── PluginDataHandling │ ├── PluginDataHandling.cpp │ ├── PluginDataHandling.rc │ ├── PluginDataHandling.vcxproj │ └── PluginDataHandling.vcxproj.filters ├── PluginEmpty │ ├── PluginEmpty.cpp │ ├── PluginEmpty.rc │ ├── PluginEmpty.vcxproj │ └── PluginEmpty.vcxproj.filters ├── PluginParentChild │ ├── PluginParentChild.cpp │ ├── PluginParentChild.rc │ ├── PluginParentChild.vcxproj │ └── PluginParentChild.vcxproj.filters ├── PluginRmExecute │ ├── PluginRmExecute.cpp │ ├── PluginRmExecute.rc │ ├── PluginRmExecute.vcxproj │ └── PluginRmExecute.vcxproj.filters ├── PluginSectionVariables │ ├── PluginSectionVariables.cpp │ ├── PluginSectionVariables.rc │ ├── PluginSectionVariables.vcxproj │ └── PluginSectionVariables.vcxproj.filters ├── PluginSystemVersion │ ├── PluginSystemVersion.cpp │ ├── PluginSystemVersion.rc │ ├── PluginSystemVersion.vcxproj │ └── PluginSystemVersion.vcxproj.filters └── SDK-CPP.sln └── README.md /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: build 2 | 3 | on: push 4 | 5 | jobs: 6 | build: 7 | runs-on: windows-2025 8 | steps: 9 | - name: Clone repo 10 | uses: actions/checkout@v4 11 | 12 | - name: Setup msbuild 13 | uses: microsoft/setup-msbuild@v2 14 | 15 | - name: Build C# SDK 16 | run: msbuild.exe C#\SDK-CS.sln -t:rebuild -p:Configuration=Release -p:Platform=x64 17 | 18 | - name: Build C++ SDK 19 | run: msbuild.exe C++\SDK-CPP.sln -t:rebuild -p:Configuration=Release -p:Platform=x64 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | obj 3 | x32 4 | x64 5 | .vs 6 | *.opensdf 7 | *.sdf 8 | *.user 9 | *.suo 10 | -------------------------------------------------------------------------------- /API/DllExporter.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rainmeter/rainmeter-plugin-sdk/1c36b22c77c739d23ee0411442b007f46298f154/API/DllExporter.exe -------------------------------------------------------------------------------- /API/RainmeterAPI.cs: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2011 Rainmeter Project Developers 2 | * 3 | * This Source Code Form is subject to the terms of the GNU General Public 4 | * License; either version 2 of the License, or (at your option) any later 5 | * version. If a copy of the GPL was not distributed with this file, You can 6 | * obtain one at . */ 7 | 8 | using System; 9 | using System.Runtime.InteropServices; 10 | 11 | namespace Rainmeter 12 | { 13 | /// 14 | /// Wrapper around the Rainmeter C API. 15 | /// 16 | public class API 17 | { 18 | private IntPtr m_Rm; 19 | 20 | public API(IntPtr rm) 21 | { 22 | m_Rm = rm; 23 | } 24 | 25 | static public implicit operator API(IntPtr rm) 26 | { 27 | return new Rainmeter.API(rm); 28 | } 29 | 30 | [DllImport("Rainmeter.dll", CharSet = CharSet.Unicode)] 31 | private extern static IntPtr RmReadString(IntPtr rm, string option, string defValue, bool replaceMeasures); 32 | 33 | [DllImport("Rainmeter.dll", CharSet = CharSet.Unicode)] 34 | private extern static IntPtr RmReadStringFromSection(IntPtr rm, string section, string option, string defValue, bool replaceMeasures); 35 | 36 | [DllImport("Rainmeter.dll", CharSet = CharSet.Unicode)] 37 | private extern static double RmReadFormula(IntPtr rm, string option, double defValue); 38 | 39 | [DllImport("Rainmeter.dll", CharSet = CharSet.Unicode)] 40 | private extern static double RmReadFormulaFromSection(IntPtr rm, string section, string option, double defValue); 41 | 42 | [DllImport("Rainmeter.dll", CharSet = CharSet.Unicode)] 43 | private extern static IntPtr RmReplaceVariables(IntPtr rm, string str); 44 | 45 | [DllImport("Rainmeter.dll", CharSet = CharSet.Unicode)] 46 | private extern static IntPtr RmPathToAbsolute(IntPtr rm, string relativePath); 47 | 48 | /// 49 | /// Executes a command 50 | /// 51 | /// Pointer to current skin (See API.GetSkin) 52 | /// Bang to execute 53 | /// No return type 54 | /// 55 | /// 56 | /// [DllExport] 57 | /// internal double Update(IntPtr data) 58 | /// { 59 | /// Measure measure = (Measure)data; 60 | /// Rainmeter.API.Execute(measure->skin, "!SetVariable SomeVar 10"); // 'measure->skin' stored previously in the Initialize function 61 | /// return 0.0; 62 | /// } 63 | /// 64 | /// 65 | [DllImport("Rainmeter.dll", EntryPoint = "RmExecute", CharSet = CharSet.Unicode)] 66 | public extern static void Execute(IntPtr skin, string command); 67 | 68 | [DllImport("Rainmeter.dll")] 69 | private extern static IntPtr RmGet(IntPtr rm, RmGetType type); 70 | 71 | [DllImport("Rainmeter.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] 72 | private extern static int LSLog(int type, string unused, string message); 73 | 74 | [DllImport("Rainmeter.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)] 75 | private extern static int RmLog(IntPtr rm, LogType type, string message); 76 | 77 | private enum RmGetType 78 | { 79 | MeasureName = 0, 80 | Skin = 1, 81 | SettingsFile = 2, 82 | SkinName = 3, 83 | SkinWindowHandle = 4 84 | } 85 | 86 | public enum LogType 87 | { 88 | Error = 1, 89 | Warning = 2, 90 | Notice = 3, 91 | Debug = 4 92 | } 93 | 94 | /// 95 | /// Retrieves an option of the plugin script measure 96 | /// 97 | /// Option name 98 | /// Default value for the option if it is not found or invalid 99 | /// If true, replaces section variables in the returned string 100 | /// Returns the option value as a string 101 | /// 102 | /// 103 | /// [DllExport] 104 | /// public static void Reload(IntPtr data, IntPtr rm, ref double maxValue) 105 | /// { 106 | /// Measure measure = (Measure)data; 107 | /// Rainmeter.API api = (Rainmeter.API)rm; 108 | /// string value = api.ReadString("Value", "DefaultValue"); 109 | /// } 110 | /// 111 | /// 112 | public string ReadString(string option, string defValue, bool replaceMeasures = true) 113 | { 114 | return Marshal.PtrToStringUni(RmReadString(m_Rm, option, defValue, replaceMeasures)); 115 | } 116 | 117 | /// 118 | /// Retrieves an option of a meter/measure 119 | /// 120 | /// In older Rainmeter versions without support for this API, always returns the default value 121 | /// Meter/measure section name 122 | /// Option name 123 | /// Default value for the option if it is not found or invalid 124 | /// If true, replaces section variables in the returned string 125 | /// Returns the option value as a string 126 | /// 127 | /// 128 | /// [DllExport] 129 | /// public static void Reload(IntPtr data, IntPtr rm, ref double maxValue) 130 | /// { 131 | /// Measure measure = (Measure)data; 132 | /// Rainmeter.API api = (Rainmeter.API)rm; 133 | /// string value = api.ReadString("MySection", "Value", "DefaultValue"); 134 | /// } 135 | /// 136 | /// 137 | public string ReadStringFromSection(string section, string option, string defValue, bool replaceMeasures = true) 138 | { 139 | try 140 | { 141 | return Marshal.PtrToStringUni(RmReadStringFromSection(m_Rm, section, option, defValue, replaceMeasures)); 142 | } 143 | catch (EntryPointNotFoundException) 144 | { 145 | return defValue; 146 | } 147 | } 148 | 149 | /// 150 | /// Retrieves the option defined in the skin file and converts a relative path to a absolute path 151 | /// 152 | /// Option name to be read from skin 153 | /// Default value for the option if it is not found or invalid 154 | /// Returns the absolute path of the option value as a string 155 | /// 156 | /// 157 | /// [DllExport] 158 | /// public static void Reload(IntPtr data, IntPtr rm, ref double maxValue) 159 | /// { 160 | /// Measure measure = (Measure)data; 161 | /// Rainmeter.API api = (Rainmeter.API)rm; 162 | /// string path = api.ReadPath("MyPath", "C:\\"); 163 | /// } 164 | /// 165 | /// 166 | public string ReadPath(string option, string defValue) 167 | { 168 | return Marshal.PtrToStringUni(RmPathToAbsolute(m_Rm, ReadString(option, defValue))); 169 | } 170 | 171 | /// 172 | /// Retrieves the option defined in the skin file and converts it to a double 173 | /// 174 | /// If the option is a formula, the returned value will be the result of the parsed formula 175 | /// Option name to read from skin 176 | /// Default value for the option if it is not found, invalid, or a formula could not be parsed 177 | /// Returns the option value as a double 178 | /// 179 | /// 180 | /// [DllExport] 181 | /// public static void Reload(IntPtr data, IntPtr rm, ref double maxValue) 182 | /// { 183 | /// Measure measure = (Measure)data; 184 | /// Rainmeter.API api = (Rainmeter.API)rm; 185 | /// double value = api.ReadDouble("Value", 20.0); 186 | /// } 187 | /// 188 | /// 189 | public double ReadDouble(string option, double defValue) 190 | { 191 | return RmReadFormula(m_Rm, option, defValue); 192 | } 193 | 194 | /// 195 | /// Retrieves the option defined in a section and converts it to a double 196 | /// 197 | /// In older Rainmeter versions without support for this API, always returns the default value 198 | /// Meter/measure section name 199 | /// Option name 200 | /// Default value for the option if it is not found or invalid 201 | /// Returns the option value as a double 202 | /// 203 | /// 204 | /// [DllExport] 205 | /// public static void Reload(IntPtr data, IntPtr rm, ref double maxValue) 206 | /// { 207 | /// Measure measure = (Measure)data; 208 | /// Rainmeter.API api = (Rainmeter.API)rm; 209 | /// double value = api.ReadDoubleFromSection("Section", "Option", 20.0); 210 | /// } 211 | /// 212 | /// 213 | public double ReadDoubleFromSection(string section, string option, double defValue) 214 | { 215 | try 216 | { 217 | return RmReadFormulaFromSection(m_Rm, section, option, defValue); 218 | } 219 | catch (EntryPointNotFoundException) 220 | { 221 | return defValue; 222 | } 223 | } 224 | 225 | /// 226 | /// Retrieves the option defined in the skin file and converts it to an integer 227 | /// 228 | /// If the option is a formula, the returned value will be the result of the parsed formula 229 | /// Option name to be read from skin 230 | /// Default value for the option if it is not found, invalid, or a formula could not be parsed 231 | /// Returns the option value as an integer 232 | /// 233 | /// 234 | /// [DllExport] 235 | /// public static void Reload(IntPtr data, IntPtr rm, ref double maxValue) 236 | /// { 237 | /// Measure measure = (Measure)data; 238 | /// Rainmeter.API api = (Rainmeter.API)rm; 239 | /// int value = api.ReadInt("Value", 20); 240 | /// } 241 | /// 242 | /// 243 | public int ReadInt(string option, int defValue) 244 | { 245 | return (int)RmReadFormula(m_Rm, option, defValue); 246 | } 247 | 248 | /// 249 | /// Retrieves the option defined in a section and converts it to an integer 250 | /// 251 | /// In older Rainmeter versions without support for this API, always returns the default value 252 | /// Meter/measure section name 253 | /// Option name 254 | /// Default value for the option if it is not found or invalid 255 | /// Returns the option value as an integer 256 | /// 257 | /// 258 | /// [DllExport] 259 | /// public static void Reload(IntPtr data, IntPtr rm, ref double maxValue) 260 | /// { 261 | /// Measure measure = (Measure)data; 262 | /// Rainmeter.API api = (Rainmeter.API)rm; 263 | /// int value = api.ReadIntFromSection("Section", "Option", 20); 264 | /// } 265 | /// 266 | /// 267 | public int ReadIntFromSection(string section, string option, int defValue) 268 | { 269 | try 270 | { 271 | return (int)RmReadFormulaFromSection(m_Rm, section, option, defValue); 272 | } 273 | catch (EntryPointNotFoundException) 274 | { 275 | return defValue; 276 | } 277 | } 278 | 279 | /// 280 | /// Returns a string, replacing any variables (or section variables) within the inputted string 281 | /// 282 | /// String with unresolved variables 283 | /// Returns a string replacing any variables in the 'str' 284 | /// 285 | /// 286 | /// [DllExport] 287 | /// public static double Update(IntPtr data) 288 | /// { 289 | /// Measure measure = (Measure)data; 290 | /// string myVar = measure.api.ReplaceVariables("#MyVar#").ToUpperInvariant(); // 'measure.api' stored previously in the Initialize function 291 | /// if (myVar == "SOMETHING") { return 1.0; } 292 | /// return 0.0; 293 | /// } 294 | /// 295 | /// 296 | public string ReplaceVariables(string str) 297 | { 298 | return Marshal.PtrToStringUni(RmReplaceVariables(m_Rm, str)); 299 | } 300 | 301 | /// 302 | /// Retrieves the name of the measure 303 | /// 304 | /// Call GetMeasureName() in the Initialize function and store the results for later use 305 | /// Returns the current measure name as a string 306 | /// 307 | /// 308 | /// [DllExport] 309 | /// public static void Initialize(ref IntPtr data, IntPtr rm) 310 | /// { 311 | /// Measure measure = new Measure(); 312 | /// Rainmeter.API api = (Rainmeter.API)rm; 313 | /// measure.myName = api.GetMeasureName(); // declare 'myName' as a string in measure class 314 | /// data = GCHandle.ToIntPtr(GCHandle.Alloc(measure)); 315 | /// } 316 | /// 317 | /// 318 | public string GetMeasureName() 319 | { 320 | return Marshal.PtrToStringUni(RmGet(m_Rm, RmGetType.MeasureName)); 321 | } 322 | 323 | /// 324 | /// Retrieves an internal pointer to the current skin 325 | /// 326 | /// Call GetSkin() in the Initialize function and store the results for later use 327 | /// Returns an IntPtr to the current skin 328 | /// 329 | /// 330 | /// [DllExport] 331 | /// public static void Initialize(ref IntPtr data, IntPtr rm) 332 | /// { 333 | /// Measure measure = new Measure(); 334 | /// Rainmeter.API api = (Rainmeter.API)rm; 335 | /// measure.mySkin = api.GetSkin(); // declare 'mySkin' as a IntPtr in measure class 336 | /// data = GCHandle.ToIntPtr(GCHandle.Alloc(measure)); 337 | /// } 338 | /// 339 | /// 340 | public IntPtr GetSkin() 341 | { 342 | return RmGet(m_Rm, RmGetType.Skin); 343 | } 344 | 345 | /// 346 | /// Retrieves a path to the Rainmeter data file (Rainmeter.data) 347 | /// 348 | /// Call GetSettingsFile() in the Initialize function and store the results for later use 349 | /// Returns the path and filename of the Rainmeter data file as a string 350 | /// 351 | /// 352 | /// public static void Initialize(ref IntPtr data, IntPtr rm) 353 | /// { 354 | /// data = GCHandle.ToIntPtr(GCHandle.Alloc(new Measure())); 355 | /// Rainmeter.API api = (Rainmeter.API)rm; 356 | /// if (rmDataFile == null) { rmDataFile = API.GetSettingsFile(); } // declare 'rmDataFile' as a string in global scope 357 | /// } 358 | /// 359 | /// 360 | public static string GetSettingsFile() 361 | { 362 | return Marshal.PtrToStringUni(RmGet(IntPtr.Zero, RmGetType.SettingsFile)); 363 | } 364 | 365 | /// 366 | /// Retrieves full path and name of the skin 367 | /// 368 | /// Call GetSkinName() in the Initialize function and store the results for later use 369 | /// Returns the path and filename of the skin as a string 370 | /// 371 | /// 372 | /// [DllExport] 373 | /// public static void Initialize(ref IntPtr data, IntPtr rm) 374 | /// { 375 | /// Measure measure = new Measure(); 376 | /// Rainmeter.API api = (Rainmeter.API)rm; 377 | /// measure.skinName = api.GetSkinName(); } // declare 'skinName' as a string in measure class 378 | /// data = GCHandle.ToIntPtr(GCHandle.Alloc(measure)); 379 | /// } 380 | /// 381 | /// 382 | public string GetSkinName() 383 | { 384 | return Marshal.PtrToStringUni(RmGet(m_Rm, RmGetType.SkinName)); 385 | } 386 | 387 | /// 388 | /// Executes a command auto getting the skin reference 389 | /// 390 | /// Bang to execute 391 | /// No return type 392 | /// 393 | /// 394 | /// [DllExport] 395 | /// public static double Update(IntPtr data) 396 | /// { 397 | /// Measure measure = (Measure)data; 398 | /// measure.api.Execute("!SetVariable SomeVar 10"); // 'measure.api' stored previously in the Initialize function 399 | /// return 0.0; 400 | /// } 401 | /// 402 | /// 403 | public void Execute(string command) 404 | { 405 | Execute(this.GetSkin(), command); 406 | } 407 | 408 | /// 409 | /// Returns a pointer to the handle of the skin window (HWND) 410 | /// 411 | /// Call GetSkinWindow() in the Initialize function and store the results for later use 412 | /// Returns a handle to the skin window as a IntPtr 413 | /// 414 | /// 415 | /// [DllExport] 416 | /// internal void Initialize(Rainmeter.API rm) 417 | /// { 418 | /// Measure measure = new Measure(); 419 | /// Rainmeter.API api = (Rainmeter.API)rm; 420 | /// measure.skinWindow = api.GetSkinWindow(); } // declare 'skinWindow' as a IntPtr in measure class 421 | /// data = GCHandle.ToIntPtr(GCHandle.Alloc(measure)); 422 | /// } 423 | /// 424 | /// 425 | public IntPtr GetSkinWindow() 426 | { 427 | return RmGet(m_Rm, RmGetType.SkinWindowHandle); 428 | } 429 | 430 | /// 431 | /// DEPRECATED: Save your rm or api reference and use Log(rm, type, message). Sends a message to the Rainmeter log with no source. 432 | /// 433 | public static void Log(int type, string message) 434 | { 435 | LSLog(type, null, message); 436 | } 437 | 438 | /// 439 | /// Sends a message to the Rainmeter log with source 440 | /// 441 | /// LOG_DEBUG messages are logged only when Rainmeter is in debug mode 442 | /// Pointer to the plugin measure 443 | /// Log type, use API.LogType enum (Error, Warning, Notice, or Debug) 444 | /// Message to be logged 445 | /// No return type 446 | /// 447 | /// 448 | /// Rainmeter.API.Log(rm, API.LogType.Notice, "I am a 'notice' log message with a source"); 449 | /// 450 | /// 451 | public static void Log(IntPtr rm, LogType type, string message) 452 | { 453 | RmLog(rm, type, message); 454 | } 455 | 456 | /// 457 | /// 458 | /// Sends a formatted message to the Rainmeter log 459 | /// 460 | /// LOG_DEBUG messages are logged only when Rainmeter is in debug mode 461 | /// Pointer to the plugin measure 462 | /// Log type, use API.LogType enum (Error, Warning, Notice, or Debug) 463 | /// Formatted message to be logged, follows string.Format syntax 464 | /// Comma separated list of args referenced in the formatted message 465 | /// No return type 466 | /// 467 | /// 468 | /// [DllExport] 469 | /// public static double Update(IntPtr data) 470 | /// { 471 | /// Measure measure = (Measure)data; 472 | /// string notice = "notice"; 473 | /// measure.api.LogF(measure.rm, API.LogType.Notice, "I am a '{0}' log message with a source", notice); // 'measure.rm' stored previously in the Initialize function 474 | /// 475 | /// return 0.0; 476 | /// } 477 | /// 478 | /// 479 | public static void LogF(IntPtr rm, LogType type, string format, params Object[] args) 480 | { 481 | RmLog(rm, type, string.Format(format, args)); 482 | } 483 | 484 | /// 485 | /// Sends a message to the Rainmeter log with source 486 | /// 487 | /// LOG_DEBUG messages are logged only when Rainmeter is in debug mode 488 | /// Log type, use API.LogType enum (Error, Warning, Notice, or Debug) 489 | /// Message to be logged 490 | /// No return type 491 | /// 492 | /// 493 | /// [DllExport] 494 | /// public static double Update(IntPtr data) 495 | /// { 496 | /// Measure measure = (Measure)data; 497 | /// measure.api.Log(api, API.LogType.Notice, "I am a 'notice' log message with a source"); // 'measure.api' stored previously in the Initialize function 498 | /// 499 | /// return 0.0; 500 | /// } 501 | /// 502 | /// 503 | public void Log(LogType type, string message) 504 | { 505 | RmLog(this.m_Rm, type, message); 506 | } 507 | 508 | /// 509 | /// Sends a formatted message to the Rainmeter log 510 | /// 511 | /// LOG_DEBUG messages are logged only when Rainmeter is in debug mode 512 | /// Log type, use API.LogType enum (Error, Warning, Notice, or Debug) 513 | /// Formatted message to be logged, follows string.Format syntax 514 | /// Comma separated list of args referenced in the formatted message 515 | /// No return type 516 | /// 517 | /// 518 | /// [DllExport] 519 | /// public static double Update(IntPtr data) 520 | /// { 521 | /// Measure measure = (Measure)data; 522 | /// string notice = "notice"; 523 | /// measure.api.LogF(API.LogType.Notice, "I am a '{0}' log message with a source", notice); // 'measure.api' stored previously in the Initialize function 524 | /// 525 | /// return 0.0; 526 | /// } 527 | /// 528 | /// 529 | public void LogF(LogType type, string format, params Object[] args) 530 | { 531 | RmLog(this.m_Rm, type, string.Format(format, args)); 532 | } 533 | } 534 | 535 | /// 536 | /// Helper for returning strings back to Rainmeter as an IntPtr. 537 | /// 538 | /// 539 | /// 540 | /// [DllExport] 541 | /// public static IntPtr GetString(IntPtr data) 542 | /// { 543 | /// return Rainmeter.StringBuffer.Update("hello"); 544 | /// } 545 | /// 546 | /// 547 | public sealed class StringBuffer 548 | { 549 | private static readonly StringBuffer s_Instance = new StringBuffer(); 550 | 551 | private IntPtr m_Buffer = IntPtr.Zero; 552 | 553 | static StringBuffer() 554 | { 555 | } 556 | 557 | private StringBuffer() 558 | { 559 | } 560 | 561 | ~StringBuffer() 562 | { 563 | FreeBuffer(); 564 | } 565 | 566 | private void FreeBuffer() 567 | { 568 | if (m_Buffer != IntPtr.Zero) 569 | { 570 | Marshal.FreeHGlobal(m_Buffer); 571 | m_Buffer = IntPtr.Zero; 572 | } 573 | } 574 | 575 | public static IntPtr Update(string value) 576 | { 577 | s_Instance.FreeBuffer(); 578 | s_Instance.m_Buffer = value != null ? Marshal.StringToHGlobalUni(value) : IntPtr.Zero; 579 | return s_Instance.m_Buffer; 580 | } 581 | 582 | public static IntPtr Get() 583 | { 584 | return s_Instance.m_Buffer; 585 | } 586 | } 587 | 588 | /// 589 | /// Dummy attribute to mark method as exported for DllExporter.exe. 590 | /// 591 | [AttributeUsage(AttributeTargets.Method)] 592 | public class DllExport : Attribute 593 | { 594 | public DllExport() 595 | { 596 | 597 | } 598 | } 599 | } 600 | -------------------------------------------------------------------------------- /API/RainmeterAPI.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2011 Rainmeter Project Developers 2 | * 3 | * This Source Code Form is subject to the terms of the GNU General Public 4 | * License; either version 2 of the License, or (at your option) any later 5 | * version. If a copy of the GPL was not distributed with this file, You can 6 | * obtain one at . */ 7 | 8 | #ifndef __RAINMETERAPI_H__ 9 | #define __RAINMETERAPI_H__ 10 | 11 | #ifdef LIBRARY_EXPORTS 12 | #define LIBRARY_EXPORT EXTERN_C 13 | #else 14 | #define LIBRARY_EXPORT EXTERN_C __declspec(dllimport) 15 | #endif // LIBRARY_EXPORTS 16 | 17 | #define PLUGIN_EXPORT EXTERN_C __declspec(dllexport) 18 | 19 | // 20 | // Exported functions 21 | // 22 | 23 | /// 24 | /// Retrieves an option of the plugin script measure 25 | /// 26 | /// Pointer to the plugin measure 27 | /// Option name 28 | /// Default value for the option if it is not found or invalid 29 | /// If true, replaces section variables in the returned string 30 | /// Returns the option value as a string (LPCWSTR) 31 | /// 32 | /// 33 | /// PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue) 34 | /// { 35 | /// LPCWSTR value = RmReadString(rm, L"Value", L"DefaultValue"); 36 | /// } 37 | /// 38 | /// 39 | LIBRARY_EXPORT LPCWSTR __stdcall RmReadString(void* rm, LPCWSTR option, LPCWSTR defValue, BOOL replaceMeasures = TRUE); 40 | 41 | /// 42 | /// Retrieves an option of a meter/measure 43 | /// 44 | /// In older Rainmeter versions without support for this API, always returns the default value 45 | /// Pointer to the plugin measure 46 | /// Meter/measure section name 47 | /// Option name 48 | /// Default value for the option if it is not found or invalid 49 | /// If true, replaces section variables in the returned string 50 | /// Returns the option value as a string (LPCWSTR) 51 | /// 52 | /// 53 | /// PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue) 54 | /// { 55 | /// LPCWSTR value = RmReadStringFromSection(rm, L"MySection", L"Value", L"DefaultValue"); 56 | /// } 57 | /// 58 | /// 59 | #ifdef LIBRARY_EXPORTS 60 | LIBRARY_EXPORT LPCWSTR __stdcall RmReadStringFromSection(void* rm, LPCWSTR section, LPCWSTR option, LPCWSTR defValue, BOOL replaceMeasures = TRUE); 61 | #else 62 | inline LPCWSTR RmReadStringFromSection(void* rm, LPCWSTR section, LPCWSTR option, LPCWSTR defValue, BOOL replaceMeasures = TRUE) 63 | { 64 | typedef LPCWSTR(__stdcall* RmReadStringFromSectionFunc)(void*, LPCWSTR, LPCWSTR, LPCWSTR, BOOL); 65 | static auto delayedFunc = (RmReadStringFromSectionFunc)GetProcAddress(GetModuleHandle(L"Rainmeter.dll"), "RmReadStringFromSection"); 66 | if (delayedFunc) 67 | { 68 | return delayedFunc(rm, section, option, defValue, replaceMeasures); 69 | } 70 | 71 | return defValue; 72 | } 73 | #endif 74 | 75 | /// 76 | /// Retrieves an option of the plugin script measure as a number after parsing possible formula 77 | /// 78 | /// Pointer to the plugin measure 79 | /// Option name 80 | /// Default value for the option if it is not found, invalid, or a formula could not be parsed 81 | /// Returns the option value as an double 82 | /// 83 | /// 84 | /// PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue) 85 | /// { 86 | /// double value = RmReadFormula(rm, L"Value", 20); 87 | /// } 88 | /// 89 | /// 90 | LIBRARY_EXPORT double __stdcall RmReadFormula(void* rm, LPCWSTR option, double defValue); 91 | 92 | /// 93 | /// Retrieves an option of a meter/measure as a number after parsing possible formula 94 | /// 95 | /// In older Rainmeter versions without support for this API, always returns the default value 96 | /// Pointer to the plugin measure 97 | /// Meter/measure section name 98 | /// Option name 99 | /// Default value for the option if it is not found, invalid, or a formula could not be parsed 100 | /// Returns the option value as an double 101 | /// 102 | /// 103 | /// PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue) 104 | /// { 105 | /// double value = RmReadFormulaFromSection(rm, L"MySection", L"Value", 20); 106 | /// } 107 | /// 108 | /// 109 | #ifdef LIBRARY_EXPORTS 110 | LIBRARY_EXPORT double __stdcall RmReadFormulaFromSection(void* rm, LPCWSTR section, LPCWSTR option, double defValue); 111 | #else 112 | inline double RmReadFormulaFromSection(void* rm, LPCWSTR section, LPCWSTR option, double defValue) 113 | { 114 | typedef double(__stdcall* RmReadFormulaFromSectionFunc)(void*, LPCWSTR, LPCWSTR, double); 115 | static auto delayedFunc = (RmReadFormulaFromSectionFunc)GetProcAddress(GetModuleHandle(L"Rainmeter.dll"), "RmReadFormulaFromSection"); 116 | if (delayedFunc) 117 | { 118 | return delayedFunc(rm, section, option, defValue); 119 | } 120 | 121 | return defValue; 122 | } 123 | #endif 124 | 125 | /// 126 | /// Retrieves the option defined in a section and converts it to an integer. 127 | /// 128 | /// If the option is a formula, the returned value will be the result of the parsed formula. 129 | /// Pointer to the plugin measure 130 | /// Meter/measure section name 131 | /// Option name 132 | /// Default value if the option is not found or invalid 133 | /// Returns the option value as an integer 134 | /// 135 | /// 136 | /// PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue) 137 | /// { 138 | /// int value = RmReadIntFromSection(rm, L"Section", L"Option", 20); 139 | /// } 140 | /// 141 | /// 142 | __inline int RmReadIntFromSection(void* rm, LPCWSTR section, LPCWSTR option, int defValue) 143 | { 144 | return (int)RmReadFormulaFromSection(rm, section, option, defValue); 145 | } 146 | 147 | /// 148 | /// Retrieves the option defined in a section and converts it to a double. 149 | /// 150 | /// If the option is a formula, the returned value will be the result of the parsed formula. 151 | /// Pointer to the plugin measure 152 | /// Meter/measure section name 153 | /// Option name 154 | /// Default value if the option is not found or invalid 155 | /// Returns the option value as a double 156 | /// 157 | /// 158 | /// PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue) 159 | /// { 160 | /// double value = RmReadDoubleFromSection(rm, L"Section", L"Option", 20.0); 161 | /// } 162 | /// 163 | /// 164 | __inline double RmReadDoubleFromSection(void* rm, LPCWSTR section, LPCWSTR option, double defValue) 165 | { 166 | return RmReadFormulaFromSection(rm, section, option, defValue); 167 | } 168 | 169 | /// 170 | /// Returns a string, replacing any variables (or section variables) within the inputted string 171 | /// 172 | /// Pointer to the plugin measure 173 | /// String with unresolved variables 174 | /// Returns a string replacing any variables in the 'str' 175 | /// 176 | /// 177 | /// PLUGIN_EXPORT double Update(void* data) 178 | /// { 179 | /// Measure* measure = (Measure*)data; 180 | /// LPCWSTR myVar = RmReplaceVariables(measure->rm, L"#MyVar#"); // 'measure->rm' stored previously in the Initialize function 181 | /// if (_wcsicmp(myVar, L"SOMETHING") == 0) { return 1.0; } 182 | /// return 0.0; 183 | /// } 184 | /// 185 | /// 186 | LIBRARY_EXPORT LPCWSTR __stdcall RmReplaceVariables(void* rm, LPCWSTR str); 187 | 188 | /// 189 | /// Converts a relative path to a absolute path (use RmReadPath where appropriate) 190 | /// 191 | /// Pointer to the plugin measure 192 | /// String of path to be converted 193 | /// Returns the absolute path of the relativePath value as a string (LPCWSTR) 194 | /// 195 | /// 196 | /// PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue) 197 | /// { 198 | /// std::wstring somePath = L"..\\SomeFolder"; 199 | /// LPCWSTR path = RmPathToAbsolute(rm, somePath.c_str()); 200 | /// } 201 | /// 202 | /// 203 | LIBRARY_EXPORT LPCWSTR __stdcall RmPathToAbsolute(void* rm, LPCWSTR relativePath); 204 | 205 | /// 206 | /// Executes a command 207 | /// 208 | /// Pointer to current skin (See RmGetSkin) 209 | /// Bang to execute 210 | /// No return type 211 | /// 212 | /// 213 | /// PLUGIN_EXPORT double Update(void* data) 214 | /// { 215 | /// Measure* measure = (Measure*)data; 216 | /// RmExecute(measure->skin, L"!SetVariable SomeVar 10"); // 'measure->skin' stored previously in the Initialize function 217 | /// return 0.0; 218 | /// } 219 | /// 220 | /// 221 | LIBRARY_EXPORT void __stdcall RmExecute(void* skin, LPCWSTR command); 222 | 223 | /// 224 | /// Retrieves data from the measure or skin (use the helper functions instead) 225 | /// 226 | /// Call RmGet() in the Initialize function and store the results for later use 227 | /// Pointer to the plugin measure 228 | /// Type of information to retrieve (see RmGetType) 229 | /// Returns a pointer to an object which is determined by the 'type' 230 | /// 231 | /// 232 | /// PLUGIN_EXPORT void Initialize(void** data, void* rm) 233 | /// { 234 | /// Measure* measure = new Measure; 235 | /// *data = measure; 236 | /// measure->hwnd = RmGet(rm, RMG_SKINWINDOWHANDLE); // 'measure->hwnd' defined as HWND in class scope 237 | /// } 238 | /// 239 | /// 240 | LIBRARY_EXPORT void* __stdcall RmGet(void* rm, int type); 241 | 242 | enum RmGetType 243 | { 244 | RMG_MEASURENAME = 0, 245 | RMG_SKIN = 1, 246 | RMG_SETTINGSFILE = 2, 247 | RMG_SKINNAME = 3, 248 | RMG_SKINWINDOWHANDLE = 4 249 | }; 250 | 251 | /// 252 | /// Sends a message to the Rainmeter log with source 253 | /// 254 | /// LOG_DEBUG messages are logged only when Rainmeter is in debug mode 255 | /// Pointer to the plugin measure 256 | /// Log type (LOG_ERROR, LOG_WARNING, LOG_NOTICE, or LOG_DEBUG) 257 | /// Message to be logged 258 | /// No return type 259 | /// 260 | /// 261 | /// RmLog(rm, LOG_NOTICE, L"I am a 'notice' log message with a source"); 262 | /// 263 | /// 264 | LIBRARY_EXPORT void __stdcall RmLog(void* rm, int level, LPCWSTR message); 265 | 266 | /// 267 | /// Sends a formatted message to the Rainmeter log 268 | /// 269 | /// LOG_DEBUG messages are logged only when Rainmeter is in debug mode 270 | /// Pointer to the plugin measure 271 | /// Log level (LOG_ERROR, LOG_WARNING, LOG_NOTICE, or LOG_DEBUG) 272 | /// Formatted message to be logged, follows printf syntax 273 | /// Comma separated list of args referenced in the formatted message 274 | /// No return type 275 | /// 276 | /// 277 | /// std::wstring notice = L"notice"; 278 | /// RmLogF(rm, LOG_NOTICE, L"I am a '%s' log message with a source", notice.c_str()); 279 | /// 280 | /// 281 | LIBRARY_EXPORT void __cdecl RmLogF(void* rm, int level, LPCWSTR format, ...); 282 | 283 | /// 284 | /// DEPRECATED: Use RmLog. Sends a message to the Rainmeter log. 285 | /// 286 | LIBRARY_EXPORT BOOL __cdecl LSLog(int level, LPCWSTR unused, LPCWSTR message); 287 | 288 | // 289 | // Wrapper functions 290 | // 291 | 292 | #ifndef LIBRARY_EXPORTS 293 | /// 294 | /// Retrieves the option defined in the skin file and converts a relative path to a absolute path 295 | /// 296 | /// Pointer to the plugin measure 297 | /// Option name to be read from skin 298 | /// Default value for the option if it is not found or invalid 299 | /// Returns the absolute path of the option value as a string (LPCWSTR) 300 | /// 301 | /// 302 | /// PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue) 303 | /// { 304 | /// LPCWSTR path = RmReadPath(rm, L"MyPath", L"C:\\"); 305 | /// } 306 | /// 307 | /// 308 | __inline LPCWSTR RmReadPath(void* rm, LPCWSTR option, LPCWSTR defValue) 309 | { 310 | LPCWSTR relativePath = RmReadString(rm, option, defValue, TRUE); 311 | return RmPathToAbsolute(rm, relativePath); 312 | } 313 | 314 | /// 315 | /// Retrieves the option defined in the skin file and converts it to an integer 316 | /// 317 | /// If the option is a formula, the returned value will be the result of the parsed formula 318 | /// Pointer to the plugin measure 319 | /// Option name to be read from skin 320 | /// Default value for the option if it is not found, invalid, or a formula could not be parsed 321 | /// Returns the option value as an integer 322 | /// 323 | /// 324 | /// PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue) 325 | /// { 326 | /// int value = RmReadInt(rm, L"Value", 20); 327 | /// } 328 | /// 329 | /// 330 | __inline int RmReadInt(void* rm, LPCWSTR option, int defValue) 331 | { 332 | return (int)RmReadFormula(rm, option, defValue); 333 | } 334 | 335 | /// 336 | /// Retrieves the option defined in the skin file and converts it to a double 337 | /// 338 | /// If the option is a formula, the returned value will be the result of the parsed formula 339 | /// Pointer to the plugin measure 340 | /// Option name to read from skin 341 | /// Default value for the option if it is not found, invalid, or a formula could not be parsed 342 | /// Returns the option value as a double 343 | /// 344 | /// 345 | /// PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue) 346 | /// { 347 | /// double value = RmReadDouble(rm, L"Value", 20.0); 348 | /// } 349 | /// 350 | /// 351 | __inline double RmReadDouble(void* rm, LPCWSTR option, double defValue) 352 | { 353 | return RmReadFormula(rm, option, defValue); 354 | } 355 | 356 | /// 357 | /// Retrieves the name of the measure 358 | /// 359 | /// Call RmGetMeasureName() in the Initialize function and store the results for later use 360 | /// Pointer to the plugin measure 361 | /// Returns the current measure name as a string (LPCWSTR) 362 | /// 363 | /// 364 | /// PLUGIN_EXPORT void Initialize(void** data, void* rm) 365 | /// { 366 | /// Measure* measure = new Measure; 367 | /// *data = measure; 368 | /// measure->myName = RmGetMeasureName(rm); // 'measure->myName' defined as a string (LPCWSTR) in class scope 369 | /// } 370 | /// 371 | /// 372 | __inline LPCWSTR RmGetMeasureName(void* rm) 373 | { 374 | return (LPCWSTR)RmGet(rm, RMG_MEASURENAME); 375 | } 376 | 377 | /// 378 | /// Retrieves a path to the Rainmeter data file (Rainmeter.data). 379 | /// 380 | /// Call GetSettingsFile() in the Initialize function and store the results for later use 381 | /// Returns the path and filename of the Rainmeter data file as a string (LPCWSTR) 382 | /// 383 | /// 384 | /// PLUGIN_EXPORT void Initialize(void** data, void* rm) 385 | /// { 386 | /// Measure* measure = new Measure; 387 | /// *data = measure; 388 | /// if (rmDataFile == nullptr) { rmDataFile = RmGetSettingsFile(); } // 'rmDataFile' defined as a string (LPCWSTR) in global scope 389 | /// } 390 | /// 391 | /// 392 | __inline LPCWSTR RmGetSettingsFile() 393 | { 394 | return (LPCWSTR)RmGet(NULL, RMG_SETTINGSFILE); 395 | } 396 | 397 | /// 398 | /// Retrieves an internal pointer to the current skin 399 | /// 400 | /// Call GetSkin() in the Initialize function and store the results for later use 401 | /// Pointer to the plugin measure 402 | /// Returns a pointer to the current skin 403 | /// 404 | /// 405 | /// PLUGIN_EXPORT void Initialize(void** data, void* rm) 406 | /// { 407 | /// Measure* measure = new Measure; 408 | /// *data = measure; 409 | /// measure->mySkin = RmGetSkin(rm); // 'measure->mySkin' defined as a 'void*' in class scope 410 | /// } 411 | /// 412 | /// 413 | __inline void* RmGetSkin(void* rm) 414 | { 415 | return (void*)RmGet(rm, RMG_SKIN); 416 | } 417 | 418 | /// 419 | /// Retrieves full path and name of the skin 420 | /// 421 | /// Call GetSkinName() in the Initialize function and store the results for later use 422 | /// Pointer to the plugin measure 423 | /// Returns the path and filename of the skin as a string (LPCWSTR) 424 | /// 425 | /// 426 | /// PLUGIN_EXPORT void Initialize(void** data, void* rm) 427 | /// { 428 | /// Measure* measure = new Measure; 429 | /// *data = measure; 430 | /// skinName = RmGetSkinName(rm); } // 'measure->skinName' defined as a string (LPCWSTR) in class scope 431 | /// } 432 | /// 433 | /// 434 | __inline LPCWSTR RmGetSkinName(void* rm) 435 | { 436 | return (LPCWSTR)RmGet(rm, RMG_SKINNAME); 437 | } 438 | 439 | /// 440 | /// Returns a pointer to the handle of the skin window (HWND) 441 | /// 442 | /// Call GetSkinWindow() in the Initialize function and store the results for later use 443 | /// Pointer to the plugin measure 444 | /// Returns a handle to the skin window as a HWND 445 | /// 446 | /// 447 | /// PLUGIN_EXPORT void Initialize(void** data, void* rm) 448 | /// { 449 | /// Measure* measure = new Measure; 450 | /// *data = measure; 451 | /// measure->skinWindow = RmGetSkinWindow(rm); } // 'measure->skinWindow' defined as HWND in class scope 452 | /// } 453 | /// 454 | /// 455 | __inline HWND RmGetSkinWindow(void* rm) 456 | { 457 | return (HWND)RmGet(rm, RMG_SKINWINDOWHANDLE); 458 | } 459 | 460 | /// 461 | /// DEPRECATED: Use RmLog(rm, type, message). Sends a message to the Rainmeter log. 462 | /// 463 | __inline void RmLog(int level, LPCWSTR message) 464 | { 465 | LSLog(level, NULL, message); 466 | } 467 | 468 | enum LOGLEVEL 469 | { 470 | LOG_ERROR = 1, 471 | LOG_WARNING = 2, 472 | LOG_NOTICE = 3, 473 | LOG_DEBUG = 4 474 | }; 475 | #endif // LIBRARY_EXPORTS 476 | 477 | #endif 478 | -------------------------------------------------------------------------------- /API/x32/Rainmeter.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rainmeter/rainmeter-plugin-sdk/1c36b22c77c739d23ee0411442b007f46298f154/API/x32/Rainmeter.lib -------------------------------------------------------------------------------- /API/x64/Rainmeter.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rainmeter/rainmeter-plugin-sdk/1c36b22c77c739d23ee0411442b007f46298f154/API/x64/Rainmeter.lib -------------------------------------------------------------------------------- /C#/PluginDataHandling/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | [assembly: AssemblyCopyright("© 2014 - YOUR NAME")] 5 | [assembly: AssemblyVersion("1.0.0.0")] 6 | 7 | // Do not change the entries below! 8 | #if X64 9 | [assembly: AssemblyInformationalVersion("3.0.2.2161 (64-bit)")] 10 | #else 11 | [assembly: AssemblyInformationalVersion("3.0.2.2161 (32-bit)")] 12 | #endif 13 | [assembly: AssemblyProduct("Rainmeter")] 14 | -------------------------------------------------------------------------------- /C#/PluginDataHandling/PluginDataHandling.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2017 Trevor Hamilton 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | using System; 20 | using System.Collections.Generic; 21 | using System.Runtime.InteropServices; 22 | using Rainmeter; 23 | 24 | // Overview: This example demonstrates using both the data argument to keep data across 25 | // functions calls and also storing data in the Rainmeter.Data file for presistance across 26 | // skin reloads and even measures. In this example we will make a counter that counts the 27 | // number of updates that happens and saves them on Finalize to the Rainmeter.data 28 | // Note: You should never rely on Update happening at the exact time you specify 29 | 30 | // Sample skin: 31 | /* 32 | [Rainmeter] 33 | Update=1000 34 | DynamicWindowSize=1 35 | BackgroundMode=2 36 | SolidColor=255,255,255 37 | 38 | [mCount] 39 | Measure=Plugin 40 | Plugin=DataHandling.dll 41 | StoreData=1 42 | 43 | [TextCount] 44 | Meter=String 45 | MeasureName=mCount 46 | X=0 47 | Y=0R 48 | FontSize=20 49 | Text=%1 50 | 51 | [mCountAt0] 52 | Measure=Plugin 53 | Plugin=DataHandling.dll 54 | StartingValue=0 55 | 56 | [TextCountAt0] 57 | Meter=String 58 | MeasureName=mCountAt0 59 | X=0 60 | Y=0R 61 | FontSize=20 62 | Text=%1 63 | */ 64 | 65 | namespace PluginDataHandling 66 | { 67 | class Measure 68 | { 69 | static public implicit operator Measure(IntPtr data) 70 | { 71 | return (Measure)GCHandle.FromIntPtr(data).Target; 72 | } 73 | public int myCounter = 0; 74 | public bool storeData = false; 75 | } 76 | 77 | public class Plugin 78 | { 79 | //Used for reading and writing values from the rainmeter settings file 80 | [DllImport("kernel32.dll", CharSet = CharSet.Unicode)] 81 | static extern int GetPrivateProfileString(string section, string key, string defaultValue, 82 | [In, Out] char[] value, int size, string filePath); 83 | 84 | [DllImport("kernel32", CharSet = CharSet.Unicode, SetLastError = true)] 85 | [return: MarshalAs(UnmanagedType.Bool)] 86 | private static extern bool WritePrivateProfileString(string section, string key, 87 | string value, string filePath); 88 | 89 | static string PluginName = "DataHandling"; //Always match this to your plugin name 90 | static string KeyName = "StoredCount"; //You can have multiple keys for your plugin that you store different info under 91 | const int MAXSIZE = 256; 92 | 93 | [DllExport] 94 | public static void Initialize(ref IntPtr data, IntPtr rm) 95 | { 96 | data = GCHandle.ToIntPtr(GCHandle.Alloc(new Measure())); 97 | } 98 | 99 | [DllExport] 100 | public static void Reload(IntPtr data, IntPtr rm, ref double maxValue) 101 | { 102 | Measure measure = (Measure)data; 103 | Rainmeter.API api = (Rainmeter.API)rm; 104 | 105 | //Get starting value if one is defined 106 | int startValue = api.ReadInt("StartingValue", -1); 107 | 108 | //If string from option was null read from file 109 | if (startValue == -1) 110 | { 111 | char[] outString = new char[MAXSIZE]; 112 | 113 | //Read from Rainmeter.data file, if no instace exists start at 0 114 | GetPrivateProfileString(PluginName, KeyName, "0", outString, MAXSIZE, API.GetSettingsFile()); 115 | 116 | try 117 | { 118 | //Need try catch just in case someone tampers with the file and the value stored is not a number 119 | string intString = new string(outString); 120 | measure.myCounter = Convert.ToInt32(intString); 121 | } 122 | catch 123 | { 124 | api.Log(API.LogType.Error, "Error converting value stored in Rainmeter.data to integer"); 125 | } 126 | } 127 | else 128 | { 129 | measure.myCounter = startValue; 130 | } 131 | 132 | //If store data is 1 then save data when measure is unloaded 133 | measure.storeData = api.ReadInt("StoreData", 0) == 1 ? true : false; 134 | } 135 | 136 | [DllExport] 137 | public static double Update(IntPtr data) 138 | { 139 | Measure measure = (Measure)data; 140 | 141 | return ++measure.myCounter; 142 | } 143 | 144 | [DllExport] 145 | public static void Finalize(IntPtr data) 146 | { 147 | Measure measure = (Measure)data; 148 | 149 | //Note that in this example if multiple measures have store data set to true whichever unloads last's data will persist 150 | if (measure.storeData) 151 | { 152 | WritePrivateProfileString(PluginName, KeyName, measure.myCounter.ToString(), API.GetSettingsFile()); 153 | } 154 | 155 | GCHandle.FromIntPtr(data).Free(); 156 | } 157 | } 158 | } 159 | -------------------------------------------------------------------------------- /C#/PluginDataHandling/PluginDataHandling.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | x86 6 | 9.0.30729 7 | 2.0 8 | {29C1A579-28E6-4D9C-BA9C-BECF4EFEB759} 9 | Library 10 | Properties 11 | PluginDataHandling 12 | DataHandling 13 | v4.7.1 14 | 512 15 | 3.5 16 | 17 | publish\ 18 | true 19 | Disk 20 | false 21 | Foreground 22 | 7 23 | Days 24 | false 25 | false 26 | true 27 | 0 28 | 1.0.0.%2a 29 | false 30 | false 31 | true 32 | 33 | 34 | 35 | true 36 | full 37 | false 38 | x32\Debug\ 39 | TRACE;DEBUG 40 | prompt 41 | 4 42 | 1607 43 | x86 44 | false 45 | 46 | 47 | none 48 | true 49 | x32\Release\ 50 | TRACE 51 | prompt 52 | 4 53 | 1607 54 | x86 55 | false 56 | 57 | 58 | true 59 | x64\Debug\ 60 | TRACE;DEBUG;X64 61 | full 62 | x64 63 | prompt 64 | 1607 65 | false 66 | 67 | 68 | x64\Release\ 69 | TRACE;X64 70 | true 71 | none 72 | x64 73 | prompt 74 | 1607 75 | false 76 | 77 | 78 | Always 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 96 | 97 | "$(SolutionDir)..\API\DllExporter.exe" "$(ConfigurationName)" "$(PlatformName)" "$(TargetDir)\" "$(TargetFileName)" 98 | 99 | -------------------------------------------------------------------------------- /C#/PluginEmpty/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | [assembly: AssemblyCopyright("© 2014 - YOUR NAME")] 5 | [assembly: AssemblyVersion("1.0.0.0")] 6 | 7 | // Do not change the entries below! 8 | #if X64 9 | [assembly: AssemblyInformationalVersion("3.0.2.2161 (64-bit)")] 10 | #else 11 | [assembly: AssemblyInformationalVersion("3.0.2.2161 (32-bit)")] 12 | #endif 13 | [assembly: AssemblyProduct("Rainmeter")] 14 | -------------------------------------------------------------------------------- /C#/PluginEmpty/PluginEmpty.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Runtime.InteropServices; 4 | using Rainmeter; 5 | 6 | // Overview: This is a blank canvas on which to build your plugin. 7 | 8 | // Note: GetString, ExecuteBang and MyCustomFunction for use as a section variable 9 | // have been commented out. If you need GetString, ExecuteBang, and/or section variables 10 | // and you have read what they are used for from the SDK docs, uncomment the function(s). 11 | // Otherwise leave them commented out (or get rid of them)! 12 | 13 | namespace PluginEmpty 14 | { 15 | class Measure 16 | { 17 | static public implicit operator Measure(IntPtr data) 18 | { 19 | return (Measure)GCHandle.FromIntPtr(data).Target; 20 | } 21 | 22 | // Include your measure data/functions here. 23 | } 24 | 25 | public class Plugin 26 | { 27 | [DllExport] 28 | public static void Initialize(ref IntPtr data, IntPtr rm) 29 | { 30 | data = GCHandle.ToIntPtr(GCHandle.Alloc(new Measure())); 31 | Rainmeter.API api = (Rainmeter.API)rm; 32 | } 33 | 34 | [DllExport] 35 | public static void Finalize(IntPtr data) 36 | { 37 | Measure measure = (Measure)data; 38 | 39 | GCHandle.FromIntPtr(data).Free(); 40 | } 41 | 42 | [DllExport] 43 | public static void Reload(IntPtr data, IntPtr rm, ref double maxValue) 44 | { 45 | Measure measure = (Measure)data; 46 | } 47 | 48 | [DllExport] 49 | public static double Update(IntPtr data) 50 | { 51 | Measure measure = (Measure)data; 52 | return 0.0; 53 | } 54 | 55 | //[DllExport] 56 | //public static IntPtr GetString(IntPtr data) 57 | //{ 58 | // Measure measure = (Measure)data; 59 | // return Rainmeter.StringBuffer.Update(""); 60 | //} 61 | 62 | //[DllExport] 63 | //public static void ExecuteBang(IntPtr data, [MarshalAs(UnmanagedType.LPWStr)]String args) 64 | //{ 65 | // Measure measure = (Measure)data; 66 | //} 67 | 68 | //[DllExport] 69 | //public static IntPtr MyCustomFunction(IntPtr data, int argc, 70 | // [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPWStr, SizeParamIndex = 1)] string[] argv) 71 | //{ 72 | // return Rainmeter.StringBuffer.Update(""); 73 | //} 74 | } 75 | } 76 | 77 | -------------------------------------------------------------------------------- /C#/PluginEmpty/PluginEmpty.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | x86 6 | 9.0.30729 7 | 2.0 8 | {D31F73ED-3978-44FA-B599-49584BA30D3A} 9 | Library 10 | Properties 11 | PluginEmpty 12 | Empty 13 | v4.7.1 14 | 512 15 | 3.5 16 | 17 | publish\ 18 | true 19 | Disk 20 | false 21 | Foreground 22 | 7 23 | Days 24 | false 25 | false 26 | true 27 | 0 28 | 1.0.0.%2a 29 | false 30 | false 31 | true 32 | 33 | 34 | 35 | true 36 | full 37 | false 38 | x32\Debug\ 39 | TRACE;DEBUG 40 | prompt 41 | 4 42 | 1607 43 | x86 44 | false 45 | 46 | 47 | none 48 | true 49 | x32\Release\ 50 | TRACE 51 | prompt 52 | 4 53 | 1607 54 | x86 55 | false 56 | 57 | 58 | true 59 | x64\Debug\ 60 | TRACE;DEBUG;X64 61 | full 62 | x64 63 | prompt 64 | 1607 65 | false 66 | 67 | 68 | x64\Release\ 69 | TRACE;X64 70 | true 71 | none 72 | x64 73 | prompt 74 | 1607 75 | false 76 | 77 | 78 | Always 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 96 | 97 | "$(SolutionDir)..\API\DllExporter.exe" "$(ConfigurationName)" "$(PlatformName)" "$(TargetDir)\" "$(TargetFileName)" 98 | 99 | -------------------------------------------------------------------------------- /C#/PluginParentChild/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | [assembly: AssemblyCopyright("© 2014 - Birunthan Mohanathas")] 5 | [assembly: AssemblyVersion("1.0.0.0")] 6 | #if X64 7 | [assembly: AssemblyInformationalVersion("3.0.2.2161 (64-bit)")] 8 | #else 9 | [assembly: AssemblyInformationalVersion("3.0.2.2161 (32-bit)")] 10 | #endif 11 | [assembly: AssemblyProduct("Rainmeter")] 12 | -------------------------------------------------------------------------------- /C#/PluginParentChild/PluginParentChild.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2014 Birunthan Mohanathas 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | using System; 20 | using System.Collections.Generic; 21 | using System.Runtime.InteropServices; 22 | using Rainmeter; 23 | 24 | // Overview: This example demonstrates a basic implementation of a parent/child 25 | // measure structure. In this particular example, we have a "parent" measure 26 | // which contains the values for the options "ValueA", "ValueB", and "ValueC". 27 | // The child measures are used to return a specific value from the parent. 28 | 29 | // Use case: You could, for example, have a "main" parent measure that queries 30 | // information some data set. The child measures can then be used to return 31 | // specific information from the data queried by the parent measure. 32 | 33 | // Sample skin: 34 | /* 35 | [Rainmeter] 36 | Update=1000 37 | BackgroundMode=2 38 | SolidColor=000000 39 | 40 | [mParent] 41 | Measure=Plugin 42 | Plugin=ParentChild.dll 43 | ValueA=111 44 | ValueB=222 45 | ValueC=333 46 | Type=A 47 | 48 | [mChild1] 49 | Measure=Plugin 50 | Plugin=ParentChild.dll 51 | ParentName=mParent 52 | Type=B 53 | 54 | [mChild2] 55 | Measure=Plugin 56 | Plugin=ParentChild.dll 57 | ParentName=mParent 58 | Type=C 59 | 60 | [Text] 61 | Meter=STRING 62 | MeasureName=mParent 63 | MeasureName2=mChild1 64 | MeasureName3=mChild2 65 | X=5 66 | Y=5 67 | W=200 68 | H=55 69 | FontColor=FFFFFF 70 | Text="mParent: %1#CRLF#mChild1: %2#CRLF#mChild2: %3" 71 | */ 72 | 73 | namespace PluginParentChild 74 | { 75 | internal class Measure 76 | { 77 | internal enum MeasureType 78 | { 79 | A, 80 | B, 81 | C 82 | } 83 | 84 | internal MeasureType Type = MeasureType.A; 85 | 86 | internal virtual void Dispose() 87 | { 88 | } 89 | 90 | internal virtual void Reload(Rainmeter.API api, ref double maxValue) 91 | { 92 | string type = api.ReadString("Type", ""); 93 | switch (type.ToLowerInvariant()) 94 | { 95 | case "a": 96 | Type = MeasureType.A; 97 | break; 98 | 99 | case "b": 100 | Type = MeasureType.B; 101 | break; 102 | 103 | case "c": 104 | Type = MeasureType.C; 105 | break; 106 | 107 | default: 108 | api.Log(API.LogType.Error, "ParentChild.dll: Type=" + type + " not valid"); 109 | break; 110 | } 111 | } 112 | 113 | internal virtual double Update() 114 | { 115 | return 0.0; 116 | } 117 | } 118 | 119 | internal class ParentMeasure : Measure 120 | { 121 | // This list of all parent measures is used by the child measures to find their parent. 122 | internal static List ParentMeasures = new List(); 123 | 124 | internal string Name; 125 | internal IntPtr Skin; 126 | 127 | internal int ValueA; 128 | internal int ValueB; 129 | internal int ValueC; 130 | 131 | internal ParentMeasure() 132 | { 133 | ParentMeasures.Add(this); 134 | } 135 | 136 | internal override void Dispose() 137 | { 138 | ParentMeasures.Remove(this); 139 | } 140 | 141 | internal override void Reload(Rainmeter.API api, ref double maxValue) 142 | { 143 | base.Reload(api, ref maxValue); 144 | 145 | Name = api.GetMeasureName(); 146 | Skin = api.GetSkin(); 147 | 148 | ValueA = api.ReadInt("ValueA", 0); 149 | ValueB = api.ReadInt("ValueB", 0); 150 | ValueC = api.ReadInt("ValueC", 0); 151 | } 152 | 153 | internal override double Update() 154 | { 155 | return GetValue(Type); 156 | } 157 | 158 | internal double GetValue(MeasureType type) 159 | { 160 | switch (type) 161 | { 162 | case MeasureType.A: 163 | return ValueA; 164 | 165 | case MeasureType.B: 166 | return ValueB; 167 | 168 | case MeasureType.C: 169 | return ValueC; 170 | } 171 | 172 | return 0.0; 173 | } 174 | } 175 | 176 | internal class ChildMeasure : Measure 177 | { 178 | private ParentMeasure ParentMeasure = null; 179 | 180 | internal override void Reload(Rainmeter.API api, ref double maxValue) 181 | { 182 | base.Reload(api, ref maxValue); 183 | 184 | string parentName = api.ReadString("ParentName", ""); 185 | IntPtr skin = api.GetSkin(); 186 | 187 | // Find parent using name AND the skin handle to be sure that it's the right one. 188 | ParentMeasure = null; 189 | foreach (ParentMeasure parentMeasure in ParentMeasure.ParentMeasures) 190 | { 191 | if (parentMeasure.Skin.Equals(skin) && parentMeasure.Name.Equals(parentName)) 192 | { 193 | ParentMeasure = parentMeasure; 194 | } 195 | } 196 | 197 | if (ParentMeasure == null) 198 | { 199 | api.Log(API.LogType.Error, "ParentChild.dll: ParentName=" + parentName + " not valid"); 200 | } 201 | } 202 | 203 | internal override double Update() 204 | { 205 | if (ParentMeasure != null) 206 | { 207 | return ParentMeasure.GetValue(Type); 208 | } 209 | 210 | return 0.0; 211 | } 212 | } 213 | 214 | public static class Plugin 215 | { 216 | [DllExport] 217 | public static void Initialize(ref IntPtr data, IntPtr rm) 218 | { 219 | Rainmeter.API api = new Rainmeter.API(rm); 220 | 221 | string parent = api.ReadString("ParentName", ""); 222 | Measure measure; 223 | if (String.IsNullOrEmpty(parent)) 224 | { 225 | measure = new ParentMeasure(); 226 | } 227 | else 228 | { 229 | measure = new ChildMeasure(); 230 | } 231 | 232 | data = GCHandle.ToIntPtr(GCHandle.Alloc(measure)); 233 | } 234 | 235 | [DllExport] 236 | public static void Finalize(IntPtr data) 237 | { 238 | Measure measure = (Measure)GCHandle.FromIntPtr(data).Target; 239 | measure.Dispose(); 240 | GCHandle.FromIntPtr(data).Free(); 241 | } 242 | 243 | [DllExport] 244 | public static void Reload(IntPtr data, IntPtr rm, ref double maxValue) 245 | { 246 | Measure measure = (Measure)GCHandle.FromIntPtr(data).Target; 247 | measure.Reload(new Rainmeter.API(rm), ref maxValue); 248 | } 249 | 250 | [DllExport] 251 | public static double Update(IntPtr data) 252 | { 253 | Measure measure = (Measure)GCHandle.FromIntPtr(data).Target; 254 | return measure.Update(); 255 | } 256 | } 257 | } 258 | -------------------------------------------------------------------------------- /C#/PluginParentChild/PluginParentChild.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | x86 6 | 9.0.30729 7 | 2.0 8 | {CA8F01AC-9582-4820-AA24-919EC747536E} 9 | Library 10 | Properties 11 | PluginParentChild 12 | ParentChild 13 | v4.7.1 14 | 512 15 | 3.5 16 | 17 | publish\ 18 | true 19 | Disk 20 | false 21 | Foreground 22 | 7 23 | Days 24 | false 25 | false 26 | true 27 | 0 28 | 1.0.0.%2a 29 | false 30 | false 31 | true 32 | 33 | 34 | 35 | true 36 | full 37 | false 38 | x32\Debug\ 39 | TRACE;DEBUG 40 | prompt 41 | 4 42 | 1607 43 | x86 44 | false 45 | 46 | 47 | none 48 | true 49 | x32\Release\ 50 | TRACE 51 | prompt 52 | 4 53 | 1607 54 | x86 55 | false 56 | 57 | 58 | true 59 | x64\Debug\ 60 | TRACE;DEBUG;X64 61 | full 62 | x64 63 | prompt 64 | 1607 65 | false 66 | 67 | 68 | x64\Release\ 69 | TRACE;X64 70 | true 71 | none 72 | x64 73 | prompt 74 | 1607 75 | false 76 | 77 | 78 | Always 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 96 | 97 | "$(SolutionDir)..\API\DllExporter.exe" "$(ConfigurationName)" "$(PlatformName)" "$(TargetDir)\" "$(TargetFileName)" 98 | 99 | -------------------------------------------------------------------------------- /C#/PluginRmExecute/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | [assembly: AssemblyCopyright("© 2014 - YOUR NAME")] 5 | [assembly: AssemblyVersion("1.0.0.0")] 6 | 7 | // Do not change the entries below! 8 | #if X64 9 | [assembly: AssemblyInformationalVersion("3.0.2.2161 (64-bit)")] 10 | #else 11 | [assembly: AssemblyInformationalVersion("3.0.2.2161 (32-bit)")] 12 | #endif 13 | [assembly: AssemblyProduct("Rainmeter")] 14 | -------------------------------------------------------------------------------- /C#/PluginRmExecute/PluginRmExecute.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2017 Trevor Hamilton 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | using System; 20 | using System.Collections.Generic; 21 | using System.Runtime.InteropServices; 22 | using Rainmeter; 23 | 24 | // Overview: This is an example of how to make an option be read and execute the bang within. 25 | // It also showcases how you can get some of the affects of DynamicVariables=1 without as much 26 | // of a performance hit. As well it also shows why you should be careful of skins turning on DV=1 27 | 28 | // Sample skin: 29 | /* 30 | [Rainmeter] 31 | Update=1000 32 | DynamicWindowSize=1 33 | BackgroundMode=2 34 | SolidColor=255,255,255 35 | 36 | [Variables] 37 | Count=0 38 | Timer=5 39 | 40 | ;This measure will change TextCount after #Timer# seconds 41 | [mTimer] 42 | Measure=Plugin 43 | Plugin=RmExecute.dll 44 | Timer=#Timer# 45 | OnTimer=[!SetOption TextCount Text "This text has changed!"] 46 | 47 | [TextCount] 48 | Meter=String 49 | X=0 50 | Y=0R 51 | FontSize=20 52 | Text=This text has not changed yet. 53 | 54 | [mTimerC] 55 | Measure=Plugin 56 | Plugin=RmExecute.dll 57 | Timer=#Timer# 58 | ;Notice how we can even do more complex bangs. 59 | ;If you uncomment the code in update the variable reference will even autoupdate without DynamicVariables=1 60 | ;Or you could just uncomment DynamicVariables=1 61 | OnTimer=[!SetVariable Count "(#Count#+1)"][!SetOption TextCountC Text "This text has been updated #Count# times"] 62 | ;DynamicVariables=1 63 | 64 | [TextCountC] 65 | Meter=String 66 | X=0 67 | Y=0R 68 | FontSize=20 69 | Text=This text has been updated #Count# times 70 | */ 71 | 72 | namespace PluginRmExecute 73 | { 74 | class Measure 75 | { 76 | static public implicit operator Measure(IntPtr data) 77 | { 78 | return (Measure)GCHandle.FromIntPtr(data).Target; 79 | } 80 | public string myCommand = ""; 81 | public int updateRate; 82 | public DateTime timer; 83 | 84 | public Rainmeter.API api; 85 | } 86 | 87 | public class Plugin 88 | { 89 | [DllExport] 90 | public static void Initialize(ref IntPtr data, IntPtr rm) 91 | { 92 | Measure measure = new Measure(); 93 | Rainmeter.API api = (Rainmeter.API)rm; 94 | 95 | measure.api = api; 96 | 97 | //We do this in Initialize so that if a skin were to turn on DynamicVariables it will not break the plugin 98 | measure.timer = DateTime.UtcNow; 99 | 100 | data = GCHandle.ToIntPtr(GCHandle.Alloc(measure)); 101 | } 102 | 103 | [DllExport] 104 | public static void Reload(IntPtr data, IntPtr rm, ref double maxValue) 105 | { 106 | Measure measure = (Measure)data; 107 | Rainmeter.API api = (Rainmeter.API)rm; 108 | 109 | measure.updateRate = api.ReadInt("Timer", 1); 110 | //We dont have to replace measures here as they will be replaced during Execute so we can pass false. 111 | //Note though that doing that measures will always then have their current info in update but variables will not. See the commented out code below to have both always act like DynamicVariables=1 112 | measure.myCommand = api.ReadString("OnTimer", "", false); 113 | } 114 | 115 | [DllExport] 116 | public static double Update(IntPtr data) 117 | { 118 | Measure measure = (Measure)data; 119 | 120 | int timePassed = (int)(DateTime.UtcNow - measure.timer).TotalSeconds; 121 | 122 | if(timePassed >= measure.updateRate) 123 | { 124 | //We could also do something like this to get DynamicVariables without the need to turn them on. Uncomment this to see the second example work 125 | //measure.myCommand = measure.api.ReadString("OnTimer", "", false); 126 | 127 | measure.api.Execute(measure.myCommand); 128 | measure.timer = DateTime.UtcNow; 129 | } 130 | 131 | //Even if you don't plan for users to use it returning a value can be useful for helping with skin debugging 132 | return measure.updateRate - timePassed; 133 | } 134 | 135 | [DllExport] 136 | public static void Finalize(IntPtr data) 137 | { 138 | GCHandle.FromIntPtr(data).Free(); 139 | } 140 | } 141 | } 142 | -------------------------------------------------------------------------------- /C#/PluginRmExecute/PluginRmExecute.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | x86 6 | 9.0.30729 7 | 2.0 8 | {4AA459BF-425E-40F5-AE31-5EE97304C538} 9 | Library 10 | Properties 11 | PluginRmExecute 12 | RmExecute 13 | v4.7.1 14 | 512 15 | 3.5 16 | 17 | publish\ 18 | true 19 | Disk 20 | false 21 | Foreground 22 | 7 23 | Days 24 | false 25 | false 26 | true 27 | 0 28 | 1.0.0.%2a 29 | false 30 | false 31 | true 32 | 33 | 34 | 35 | true 36 | full 37 | false 38 | x32\Debug\ 39 | TRACE;DEBUG 40 | prompt 41 | 4 42 | 1607 43 | x86 44 | false 45 | 46 | 47 | none 48 | true 49 | x32\Release\ 50 | TRACE 51 | prompt 52 | 4 53 | 1607 54 | x86 55 | false 56 | 57 | 58 | true 59 | x64\Debug\ 60 | TRACE;DEBUG;X64 61 | full 62 | x64 63 | prompt 64 | 1607 65 | false 66 | 67 | 68 | x64\Release\ 69 | TRACE;X64 70 | true 71 | none 72 | x64 73 | prompt 74 | 1607 75 | false 76 | 77 | 78 | Always 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 96 | 97 | "$(SolutionDir)..\API\DllExporter.exe" "$(ConfigurationName)" "$(PlatformName)" "$(TargetDir)\" "$(TargetFileName)" 98 | 99 | -------------------------------------------------------------------------------- /C#/PluginSectionVariables/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | [assembly: AssemblyCopyright("© 2014 - YOUR NAME")] 5 | [assembly: AssemblyVersion("1.0.0.0")] 6 | 7 | // Do not change the entries below! 8 | #if X64 9 | [assembly: AssemblyInformationalVersion("3.0.2.2161 (64-bit)")] 10 | #else 11 | [assembly: AssemblyInformationalVersion("3.0.2.2161 (32-bit)")] 12 | #endif 13 | [assembly: AssemblyProduct("Rainmeter")] 14 | -------------------------------------------------------------------------------- /C#/PluginSectionVariables/PluginSectionVariables.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2017 Trevor Hamilton 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | using System; 20 | using System.Runtime.InteropServices; 21 | using Rainmeter; 22 | 23 | // Overview: This example demonstrates using plugin section variables, aka calling a plugin inline. 24 | // In this example we build a ToUpper and a ToLower section variable that can either get the measure text 25 | // or transform the string passed to uppercase/lowercase 26 | 27 | // Sample skin: 28 | /* 29 | [Rainmeter] 30 | Update=1000 31 | DynamicWindowSize=1 32 | BackgroundMode=2 33 | SolidColor=255,255,255 34 | 35 | [Variables] 36 | ;You can't get a Meter's text so use a variable 37 | TextString=Click me to make me uppercase! 38 | 39 | [mString] 40 | Measure=Plugin 41 | Plugin=SectionVariables.dll 42 | Input=I come from the measure reference! 43 | 44 | [TextLower] 45 | Meter=String 46 | X=0 47 | Y=0 48 | FontSize=20 49 | ;Notice how we need DynamicVariable=1 since section variables can not be called on initialize 50 | Text=[&mString:ToLower()] 51 | DynamicVariables=1 52 | 53 | [TextUpper] 54 | Meter=String 55 | X=0 56 | Y=0R 57 | FontSize=20 58 | Text=#TextString# 59 | ;Notice how we don't need DynamicVariables=1 if we set the text manually 60 | LeftMouseUpAction=[!SetOption TextUpper Text "[&mString:ToUpper(#TextString#)]"] 61 | */ 62 | 63 | namespace PluginSectionVariables 64 | { 65 | class Measure 66 | { 67 | static public implicit operator Measure(IntPtr data) 68 | { 69 | return (Measure)GCHandle.FromIntPtr(data).Target; 70 | } 71 | 72 | public string inputStr; 73 | } 74 | 75 | public class Plugin 76 | { 77 | [DllExport] 78 | public static void Initialize(ref IntPtr data, IntPtr rm) 79 | { 80 | data = GCHandle.ToIntPtr(GCHandle.Alloc(new Measure())); 81 | Rainmeter.API api = (Rainmeter.API)rm; 82 | } 83 | 84 | [DllExport] 85 | public static void Reload(IntPtr data, IntPtr rm, ref double maxValue) 86 | { 87 | Measure measure = (Measure)data; 88 | Rainmeter.API api = (Rainmeter.API)rm; 89 | 90 | measure.inputStr = api.ReadString("Input", ""); 91 | } 92 | 93 | [DllExport] 94 | public static double Update(IntPtr data) 95 | { 96 | Measure measure = (Measure)data; 97 | return 0.0; 98 | } 99 | 100 | [DllExport] 101 | public static IntPtr GetString(IntPtr data) 102 | { 103 | Measure measure = (Measure)data; 104 | return Rainmeter.StringBuffer.Update(measure.inputStr); 105 | } 106 | 107 | [DllExport] 108 | public static IntPtr ToUpper(IntPtr data, int argc, 109 | [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPWStr, SizeParamIndex = 1)] string[] argv) 110 | { 111 | Measure measure = (Measure)data; 112 | 113 | // If we are given one or more arguments convert to uppercase the first one 114 | if (argc > 0) 115 | { 116 | return Rainmeter.StringBuffer.Update(argv[0].ToUpper()); 117 | } 118 | 119 | // If we are given no arguments convert to uppercase the string we recived with the input option 120 | return Rainmeter.StringBuffer.Update(measure.inputStr.ToUpper()); 121 | } 122 | 123 | [DllExport] 124 | public static IntPtr ToLower(IntPtr data, int argc, 125 | [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPWStr, SizeParamIndex = 1)] string[] argv) 126 | { 127 | Measure measure = (Measure)data; 128 | 129 | if (argc > 0) 130 | { 131 | return Rainmeter.StringBuffer.Update(argv[0].ToUpper()); 132 | } 133 | 134 | return Rainmeter.StringBuffer.Update(measure.inputStr.ToLower()); 135 | } 136 | 137 | [DllExport] 138 | public static void Finalize(IntPtr data) 139 | { 140 | Measure measure = (Measure)data; 141 | GCHandle.FromIntPtr(data).Free(); 142 | } 143 | } 144 | } 145 | -------------------------------------------------------------------------------- /C#/PluginSectionVariables/PluginSectionVariables.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | x86 6 | 9.0.30729 7 | 2.0 8 | {4F74D778-91E1-4CB6-974A-8B0C2D5B9C09} 9 | Library 10 | Properties 11 | PluginSectionVariables 12 | SectionVariables 13 | v4.7.1 14 | 512 15 | 3.5 16 | 17 | publish\ 18 | true 19 | Disk 20 | false 21 | Foreground 22 | 7 23 | Days 24 | false 25 | false 26 | true 27 | 0 28 | 1.0.0.%2a 29 | false 30 | false 31 | true 32 | 33 | 34 | 35 | true 36 | full 37 | false 38 | x32\Debug\ 39 | TRACE;DEBUG 40 | prompt 41 | 4 42 | 1607 43 | x86 44 | false 45 | 46 | 47 | none 48 | true 49 | x32\Release\ 50 | TRACE 51 | prompt 52 | 4 53 | 1607 54 | x86 55 | false 56 | 57 | 58 | true 59 | x64\Debug\ 60 | TRACE;DEBUG;X64 61 | full 62 | x64 63 | prompt 64 | 1607 65 | false 66 | 67 | 68 | x64\Release\ 69 | TRACE;X64 70 | true 71 | none 72 | x64 73 | prompt 74 | 1607 75 | false 76 | 77 | 78 | Always 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 96 | 97 | "$(SolutionDir)..\API\DllExporter.exe" "$(ConfigurationName)" "$(PlatformName)" "$(TargetDir)\" "$(TargetFileName)" 98 | 99 | -------------------------------------------------------------------------------- /C#/PluginSystemVersion/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | [assembly: AssemblyCopyright("© 2014 - Birunthan Mohanathas")] 5 | [assembly: AssemblyVersion("1.0.0.0")] 6 | #if X64 7 | [assembly: AssemblyInformationalVersion("3.0.2.2161 (64-bit)")] 8 | #else 9 | [assembly: AssemblyInformationalVersion("3.0.2.2161 (32-bit)")] 10 | #endif 11 | [assembly: AssemblyProduct("Rainmeter")] 12 | -------------------------------------------------------------------------------- /C#/PluginSystemVersion/PluginSystemVersion.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2014 Birunthan Mohanathas 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | using System; 20 | using System.Collections.Generic; 21 | using System.Runtime.InteropServices; 22 | using Rainmeter; 23 | 24 | // Overview: This example demonstrates the basic concept of Rainmeter C# plugins. 25 | 26 | // Sample skin: 27 | /* 28 | [Rainmeter] 29 | Update=1000 30 | BackgroundMode=2 31 | SolidColor=000000 32 | 33 | [mString] 34 | Measure=Plugin 35 | Plugin=SystemVersion.dll 36 | Type=String 37 | 38 | [mMajor] 39 | Measure=Plugin 40 | Plugin=SystemVersion.dll 41 | Type=Major 42 | 43 | [mMinor] 44 | Measure=Plugin 45 | Plugin=SystemVersion.dll 46 | Type=Minor 47 | 48 | [mNumber] 49 | Measure=Plugin 50 | Plugin=SystemVersion.dll 51 | Type=Number 52 | 53 | [Text1] 54 | Meter=STRING 55 | MeasureName=mString 56 | MeasureName2=mMajor 57 | MeasureName3=mMinor 58 | MeasureName4=mNumber 59 | X=5 60 | Y=5 61 | W=300 62 | H=70 63 | FontColor=FFFFFF 64 | Text="String: %1#CRLF#Major: %2#CRLF#Minor: %3#CRLF#Number: %4#CRLF#" 65 | 66 | [Text2] 67 | Meter=STRING 68 | MeasureName=mString 69 | MeasureName2=mMajor 70 | MeasureName3=mMinor 71 | MeasureName4=mNumber 72 | NumOfDecimals=1 73 | X=5 74 | Y=5R 75 | W=300 76 | H=70 77 | FontColor=FFFFFF 78 | Text="String: %1#CRLF#Major: %2#CRLF#Minor: %3#CRLF#Number: %4#CRLF#" 79 | */ 80 | 81 | namespace PluginSystemVersion 82 | { 83 | internal class Measure 84 | { 85 | enum MeasureType 86 | { 87 | Major, 88 | Minor, 89 | Number, 90 | String 91 | } 92 | 93 | private MeasureType Type = MeasureType.Major; 94 | 95 | internal Measure() 96 | { 97 | } 98 | 99 | internal void Reload(Rainmeter.API api, ref double maxValue) 100 | { 101 | string type = api.ReadString("Type", ""); 102 | switch (type.ToLowerInvariant()) 103 | { 104 | case "major": 105 | Type = MeasureType.Major; 106 | break; 107 | 108 | case "minor": 109 | Type = MeasureType.Minor; 110 | break; 111 | 112 | case "number": 113 | Type = MeasureType.Number; 114 | break; 115 | 116 | case "string": 117 | Type = MeasureType.String; 118 | break; 119 | 120 | default: 121 | api.Log(API.LogType.Error, "SystemVersion.dll: Type=" + type + " not valid"); 122 | break; 123 | } 124 | } 125 | 126 | internal double Update() 127 | { 128 | switch (Type) 129 | { 130 | case MeasureType.Major: 131 | return (double)Environment.OSVersion.Version.Major; 132 | 133 | case MeasureType.Minor: 134 | return (double)Environment.OSVersion.Version.Minor; 135 | 136 | case MeasureType.Number: 137 | return (double)Environment.OSVersion.Version.Major + ((double)Environment.OSVersion.Version.Minor / 10.0); 138 | } 139 | 140 | // MeasureType.MajorMinor is not a number and and therefore will be 141 | // returned in GetString. 142 | 143 | return 0.0; 144 | } 145 | 146 | internal string GetString() 147 | { 148 | switch (Type) 149 | { 150 | case MeasureType.String: 151 | return string.Format("{0}.{1} (Build {2})", Environment.OSVersion.Version.Major, Environment.OSVersion.Version.Minor, Environment.OSVersion.Version.Build); 152 | } 153 | 154 | // MeasureType.Major, MeasureType.Minor, and MeasureType.Number are 155 | // numbers. Therefore, null is returned here for them. This is to 156 | // inform Rainmeter that it can treat those types as numbers. 157 | 158 | return null; 159 | } 160 | } 161 | 162 | public static class Plugin 163 | { 164 | [DllExport] 165 | public static void Initialize(ref IntPtr data, IntPtr rm) 166 | { 167 | data = GCHandle.ToIntPtr(GCHandle.Alloc(new Measure())); 168 | } 169 | 170 | [DllExport] 171 | public static void Finalize(IntPtr data) 172 | { 173 | GCHandle.FromIntPtr(data).Free(); 174 | } 175 | 176 | [DllExport] 177 | public static void Reload(IntPtr data, IntPtr rm, ref double maxValue) 178 | { 179 | Measure measure = (Measure)GCHandle.FromIntPtr(data).Target; 180 | measure.Reload(new Rainmeter.API(rm), ref maxValue); 181 | } 182 | 183 | [DllExport] 184 | public static double Update(IntPtr data) 185 | { 186 | Measure measure = (Measure)GCHandle.FromIntPtr(data).Target; 187 | return measure.Update(); 188 | } 189 | 190 | [DllExport] 191 | public static IntPtr GetString(IntPtr data) 192 | { 193 | Measure measure = (Measure)GCHandle.FromIntPtr(data).Target; 194 | return Rainmeter.StringBuffer.Update(measure.GetString()); 195 | } 196 | } 197 | } 198 | -------------------------------------------------------------------------------- /C#/PluginSystemVersion/PluginSystemVersion.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | x86 6 | 9.0.30729 7 | 2.0 8 | {F43D0210-4CED-49B0-93C4-C694EFB44282} 9 | Library 10 | Properties 11 | PluginSystemVersion 12 | SystemVersion 13 | v4.7.1 14 | 512 15 | 3.5 16 | 17 | publish\ 18 | true 19 | Disk 20 | false 21 | Foreground 22 | 7 23 | Days 24 | false 25 | false 26 | true 27 | 0 28 | 1.0.0.%2a 29 | false 30 | false 31 | true 32 | 33 | 34 | 35 | true 36 | full 37 | false 38 | x32\Debug\ 39 | TRACE;DEBUG 40 | prompt 41 | 4 42 | 1607 43 | x86 44 | false 45 | 46 | 47 | none 48 | true 49 | x32\Release\ 50 | TRACE 51 | prompt 52 | 4 53 | 1607 54 | x86 55 | false 56 | 57 | 58 | true 59 | x64\Debug\ 60 | TRACE;DEBUG;X64 61 | full 62 | x64 63 | prompt 64 | 1607 65 | false 66 | 67 | 68 | x64\Release\ 69 | TRACE;X64 70 | true 71 | none 72 | x64 73 | prompt 74 | 1607 75 | false 76 | 77 | 78 | Always 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 96 | 97 | "$(SolutionDir)..\API\DllExporter.exe" "$(ConfigurationName)" "$(PlatformName)" "$(TargetDir)\" "$(TargetFileName)" 98 | 99 | -------------------------------------------------------------------------------- /C#/SDK-CS.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 16 4 | VisualStudioVersion = 16.0.29201.188 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PluginEmpty", "PluginEmpty\PluginEmpty.csproj", "{D31F73ED-3978-44FA-B599-49584BA30D3A}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PluginParentChild", "PluginParentChild\PluginParentChild.csproj", "{CA8F01AC-9582-4820-AA24-919EC747536E}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PluginSystemVersion", "PluginSystemVersion\PluginSystemVersion.csproj", "{F43D0210-4CED-49B0-93C4-C694EFB44282}" 11 | EndProject 12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PluginDataHandling", "PluginDataHandling\PluginDataHandling.csproj", "{29C1A579-28E6-4D9C-BA9C-BECF4EFEB759}" 13 | EndProject 14 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PluginRmExecute", "PluginRmExecute\PluginRmExecute.csproj", "{4AA459BF-425E-40F5-AE31-5EE97304C538}" 15 | EndProject 16 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PluginSectionVariables", "PluginSectionVariables\PluginSectionVariables.csproj", "{4F74D778-91E1-4CB6-974A-8B0C2D5B9C09}" 17 | EndProject 18 | Global 19 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 20 | Debug|x64 = Debug|x64 21 | Debug|x86 = Debug|x86 22 | Release|x64 = Release|x64 23 | Release|x86 = Release|x86 24 | EndGlobalSection 25 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 26 | {D31F73ED-3978-44FA-B599-49584BA30D3A}.Debug|x64.ActiveCfg = Debug|x64 27 | {D31F73ED-3978-44FA-B599-49584BA30D3A}.Debug|x64.Build.0 = Debug|x64 28 | {D31F73ED-3978-44FA-B599-49584BA30D3A}.Debug|x86.ActiveCfg = Debug|x86 29 | {D31F73ED-3978-44FA-B599-49584BA30D3A}.Debug|x86.Build.0 = Debug|x86 30 | {D31F73ED-3978-44FA-B599-49584BA30D3A}.Release|x64.ActiveCfg = Release|x64 31 | {D31F73ED-3978-44FA-B599-49584BA30D3A}.Release|x64.Build.0 = Release|x64 32 | {D31F73ED-3978-44FA-B599-49584BA30D3A}.Release|x86.ActiveCfg = Release|x86 33 | {D31F73ED-3978-44FA-B599-49584BA30D3A}.Release|x86.Build.0 = Release|x86 34 | {CA8F01AC-9582-4820-AA24-919EC747536E}.Debug|x64.ActiveCfg = Debug|x64 35 | {CA8F01AC-9582-4820-AA24-919EC747536E}.Debug|x64.Build.0 = Debug|x64 36 | {CA8F01AC-9582-4820-AA24-919EC747536E}.Debug|x86.ActiveCfg = Debug|x86 37 | {CA8F01AC-9582-4820-AA24-919EC747536E}.Debug|x86.Build.0 = Debug|x86 38 | {CA8F01AC-9582-4820-AA24-919EC747536E}.Release|x64.ActiveCfg = Release|x64 39 | {CA8F01AC-9582-4820-AA24-919EC747536E}.Release|x64.Build.0 = Release|x64 40 | {CA8F01AC-9582-4820-AA24-919EC747536E}.Release|x86.ActiveCfg = Release|x86 41 | {CA8F01AC-9582-4820-AA24-919EC747536E}.Release|x86.Build.0 = Release|x86 42 | {F43D0210-4CED-49B0-93C4-C694EFB44282}.Debug|x64.ActiveCfg = Debug|x64 43 | {F43D0210-4CED-49B0-93C4-C694EFB44282}.Debug|x64.Build.0 = Debug|x64 44 | {F43D0210-4CED-49B0-93C4-C694EFB44282}.Debug|x86.ActiveCfg = Debug|x86 45 | {F43D0210-4CED-49B0-93C4-C694EFB44282}.Debug|x86.Build.0 = Debug|x86 46 | {F43D0210-4CED-49B0-93C4-C694EFB44282}.Release|x64.ActiveCfg = Release|x64 47 | {F43D0210-4CED-49B0-93C4-C694EFB44282}.Release|x64.Build.0 = Release|x64 48 | {F43D0210-4CED-49B0-93C4-C694EFB44282}.Release|x86.ActiveCfg = Release|x86 49 | {F43D0210-4CED-49B0-93C4-C694EFB44282}.Release|x86.Build.0 = Release|x86 50 | {29C1A579-28E6-4D9C-BA9C-BECF4EFEB759}.Debug|x64.ActiveCfg = Debug|x64 51 | {29C1A579-28E6-4D9C-BA9C-BECF4EFEB759}.Debug|x64.Build.0 = Debug|x64 52 | {29C1A579-28E6-4D9C-BA9C-BECF4EFEB759}.Debug|x86.ActiveCfg = Debug|x86 53 | {29C1A579-28E6-4D9C-BA9C-BECF4EFEB759}.Debug|x86.Build.0 = Debug|x86 54 | {29C1A579-28E6-4D9C-BA9C-BECF4EFEB759}.Release|x64.ActiveCfg = Release|x64 55 | {29C1A579-28E6-4D9C-BA9C-BECF4EFEB759}.Release|x64.Build.0 = Release|x64 56 | {29C1A579-28E6-4D9C-BA9C-BECF4EFEB759}.Release|x86.ActiveCfg = Release|x86 57 | {29C1A579-28E6-4D9C-BA9C-BECF4EFEB759}.Release|x86.Build.0 = Release|x86 58 | {4AA459BF-425E-40F5-AE31-5EE97304C538}.Debug|x64.ActiveCfg = Debug|x64 59 | {4AA459BF-425E-40F5-AE31-5EE97304C538}.Debug|x64.Build.0 = Debug|x64 60 | {4AA459BF-425E-40F5-AE31-5EE97304C538}.Debug|x86.ActiveCfg = Debug|x86 61 | {4AA459BF-425E-40F5-AE31-5EE97304C538}.Debug|x86.Build.0 = Debug|x86 62 | {4AA459BF-425E-40F5-AE31-5EE97304C538}.Release|x64.ActiveCfg = Release|x64 63 | {4AA459BF-425E-40F5-AE31-5EE97304C538}.Release|x64.Build.0 = Release|x64 64 | {4AA459BF-425E-40F5-AE31-5EE97304C538}.Release|x86.ActiveCfg = Release|x86 65 | {4AA459BF-425E-40F5-AE31-5EE97304C538}.Release|x86.Build.0 = Release|x86 66 | {4F74D778-91E1-4CB6-974A-8B0C2D5B9C09}.Debug|x64.ActiveCfg = Debug|x64 67 | {4F74D778-91E1-4CB6-974A-8B0C2D5B9C09}.Debug|x64.Build.0 = Debug|x64 68 | {4F74D778-91E1-4CB6-974A-8B0C2D5B9C09}.Debug|x86.ActiveCfg = Debug|x86 69 | {4F74D778-91E1-4CB6-974A-8B0C2D5B9C09}.Debug|x86.Build.0 = Debug|x86 70 | {4F74D778-91E1-4CB6-974A-8B0C2D5B9C09}.Release|x64.ActiveCfg = Release|x64 71 | {4F74D778-91E1-4CB6-974A-8B0C2D5B9C09}.Release|x64.Build.0 = Release|x64 72 | {4F74D778-91E1-4CB6-974A-8B0C2D5B9C09}.Release|x86.ActiveCfg = Release|x86 73 | {4F74D778-91E1-4CB6-974A-8B0C2D5B9C09}.Release|x86.Build.0 = Release|x86 74 | EndGlobalSection 75 | GlobalSection(SolutionProperties) = preSolution 76 | HideSolutionNode = FALSE 77 | EndGlobalSection 78 | GlobalSection(ExtensibilityGlobals) = postSolution 79 | SolutionGuid = {8AD0A00D-365F-48B7-B112-6A1AFE13C535} 80 | EndGlobalSection 81 | EndGlobal 82 | -------------------------------------------------------------------------------- /C++/PluginDataHandling/PluginDataHandling.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 Rainmeter Project Developers 2 | * 3 | * This Source Code Form is subject to the terms of the GNU General Public 4 | * License; either version 2 of the License, or (at your option) any later 5 | * version. If a copy of the GPL was not distributed with this file, You can 6 | * obtain one at . */ 7 | 8 | #include 9 | #include "../../API/RainmeterAPI.h" 10 | 11 | 12 | // Overview: This example demonstrates using both the data argument to keep data across 13 | // functions calls and also storing data in the |Rainmeter.data| file for presist access across 14 | // skin reloads and even measures. In this example we will make a counter that counts the number 15 | // of updates that happen and saves it when the skin unloads to the |Rainmeter.data| file. 16 | // Note: Remember that the Update function will not be called when the measure is paused or disabled. 17 | 18 | //Sample skin: 19 | /* 20 | [Rainmeter] 21 | Update=1000 22 | DynamicWindowSize=1 23 | BackgroundMode=2 24 | SolidColor=255,255,255 25 | 26 | [mCount] 27 | Measure=Plugin 28 | Plugin=DataHandling 29 | SaveData=1 30 | 31 | [mCountAt0] 32 | Measure=Plugin 33 | Plugin=DataHandling 34 | StartingValue=0 35 | 36 | [MeterCount] 37 | Meter=String 38 | MeasureName=mCount 39 | 40 | [MeterCountAt0] 41 | Meter=String 42 | MeasureName=mCountAt0 43 | Y=5R 44 | */ 45 | 46 | struct Measure 47 | { 48 | int counter; 49 | bool saveData; 50 | 51 | LPCWSTR dataFile; 52 | 53 | Measure() : 54 | counter(0), 55 | saveData(false), 56 | dataFile(nullptr) {} 57 | }; 58 | 59 | 60 | PLUGIN_EXPORT void Initialize(void** data, void* rm) 61 | { 62 | Measure* measure = new Measure; 63 | *data = measure; 64 | 65 | // Get the path to the settings data file 66 | measure->dataFile = RmGetSettingsFile(); 67 | } 68 | 69 | PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue) 70 | { 71 | Measure* measure = (Measure*)data; 72 | 73 | // Note: If |DynamicVariables=1| is set on the measure, this function will get called 74 | // on every update cycle - meaning the counter values will use the starting value and 75 | // appear to *not* update at all. 76 | 77 | // Get the starting value if one is defined 78 | measure->counter = RmReadInt(rm, L"StartingValue", -1); 79 | 80 | // If |StartingValue| was not defined with with measure, read the |Count| from the data file 81 | if (measure->counter < 0) 82 | { 83 | // Get |Count| from the Rainmeter data file. If the key does not exist 84 | // in the data file, 0 will be used as the default value. 85 | measure->counter = (int)GetPrivateProfileInt(L"Plugin_DataHandling", L"Count", 0, measure->dataFile); 86 | } 87 | 88 | // If the counter is to be saved in the data file, set SaveData=1 in the measure (in the 89 | // skin file). The counter will be saved to the |Count| key in the data file when the 90 | // skin is unloaded or refreshed. 91 | measure->saveData = RmReadInt(rm, L"SaveData", 0) == 1 ? true : false; 92 | } 93 | 94 | PLUGIN_EXPORT double Update(void* data) 95 | { 96 | Measure* measure = (Measure*)data; 97 | 98 | // Every measure will have its own counter separate from other measures. 99 | // Increase the counter and reset if needed. 100 | if (++measure->counter < 0) measure->counter = 0; 101 | 102 | return measure->counter; 103 | } 104 | 105 | PLUGIN_EXPORT void Finalize(void* data) 106 | { 107 | Measure* measure = (Measure*)data; 108 | 109 | if (measure->saveData) 110 | { 111 | // Note: In this example multiple |DataHandling| plugin measures (from any skin) will 112 | // overwrite this value. The counter from the last measure unloaded will persist. 113 | WCHAR buffer[SHRT_MAX]; 114 | _itow_s(measure->counter, buffer, 10); 115 | WritePrivateProfileString(L"Plugin_DataHandling", L"Count", buffer, measure->dataFile); 116 | } 117 | 118 | delete measure; 119 | } 120 | -------------------------------------------------------------------------------- /C++/PluginDataHandling/PluginDataHandling.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rainmeter/rainmeter-plugin-sdk/1c36b22c77c739d23ee0411442b007f46298f154/C++/PluginDataHandling/PluginDataHandling.rc -------------------------------------------------------------------------------- /C++/PluginDataHandling/PluginDataHandling.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Release 14 | Win32 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | {8CAA57CE-289D-4365-AC1F-0C6E3E5B76B8} 29 | Win32Proj 30 | PluginDataHandling 31 | 10.0 32 | 33 | 34 | 35 | DynamicLibrary 36 | true 37 | Unicode 38 | v143 39 | 40 | 41 | DynamicLibrary 42 | true 43 | Unicode 44 | v143 45 | 46 | 47 | DynamicLibrary 48 | false 49 | true 50 | Unicode 51 | v143 52 | 53 | 54 | DynamicLibrary 55 | false 56 | true 57 | Unicode 58 | v143 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | true 78 | DataHandling 79 | x32\$(Configuration)\ 80 | x32\$(Configuration)\ 81 | 82 | 83 | true 84 | DataHandling 85 | x64\$(Configuration)\ 86 | x64\$(Configuration)\ 87 | 88 | 89 | false 90 | DataHandling 91 | x32\$(Configuration)\ 92 | x32\$(Configuration)\ 93 | 94 | 95 | false 96 | DataHandling 97 | x64\$(Configuration)\ 98 | x64\$(Configuration)\ 99 | 100 | 101 | 102 | 103 | 104 | Level3 105 | Disabled 106 | WIN32;_DEBUG;_WINDOWS;_USRDLL;PLUGINDataHandling_EXPORTS;%(PreprocessorDefinitions) 107 | MultiThreadedDebug 108 | 109 | 110 | true 111 | ..\..\API\x32\Rainmeter.lib;%(AdditionalDependencies) 112 | Windows 113 | 114 | 115 | 116 | 117 | 118 | 119 | Level3 120 | Disabled 121 | WIN32;_DEBUG;_WINDOWS;_USRDLL;PLUGINDataHandling_EXPORTS;%(PreprocessorDefinitions) 122 | MultiThreadedDebug 123 | 124 | 125 | true 126 | ..\..\API\x64\Rainmeter.lib;%(AdditionalDependencies) 127 | Windows 128 | 129 | 130 | _WIN64;%(PreprocessorDefinitions) 131 | 132 | 133 | 134 | 135 | Level3 136 | 137 | 138 | MaxSpeed 139 | true 140 | true 141 | WIN32;NDEBUG;_WINDOWS;_USRDLL;PLUGINDataHandling_EXPORTS;%(PreprocessorDefinitions) 142 | MultiThreaded 143 | 144 | 145 | false 146 | true 147 | .rdata=.text 148 | true 149 | ..\..\API\x32\Rainmeter.lib;%(AdditionalDependencies) 150 | Windows 151 | 152 | 153 | 154 | 155 | Level3 156 | 157 | 158 | MaxSpeed 159 | true 160 | true 161 | WIN32;NDEBUG;_WINDOWS;_USRDLL;PLUGINDataHandling_EXPORTS;%(PreprocessorDefinitions) 162 | MultiThreaded 163 | 164 | 165 | false 166 | true 167 | .rdata=.text 168 | true 169 | ..\..\API\x64\Rainmeter.lib;%(AdditionalDependencies) 170 | Windows 171 | 172 | 173 | _WIN64;%(PreprocessorDefinitions) 174 | 175 | 176 | 177 | 178 | 179 | -------------------------------------------------------------------------------- /C++/PluginDataHandling/PluginDataHandling.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /C++/PluginEmpty/PluginEmpty.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "../../API/RainmeterAPI.h" 3 | 4 | // Overview: This is a blank canvas on which to build your plugin. 5 | 6 | // Note: GetString, ExecuteBang and an unnamed function for use as a section variable 7 | // have been commented out. Uncomment any functions as needed. 8 | // For more information, see the SDK docs: https://docs.rainmeter.net/developers/plugin/cpp/ 9 | 10 | struct Measure 11 | { 12 | Measure() {} 13 | }; 14 | 15 | PLUGIN_EXPORT void Initialize(void** data, void* rm) 16 | { 17 | Measure* measure = new Measure; 18 | *data = measure; 19 | } 20 | 21 | PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue) 22 | { 23 | Measure* measure = (Measure*)data; 24 | } 25 | 26 | PLUGIN_EXPORT double Update(void* data) 27 | { 28 | Measure* measure = (Measure*)data; 29 | return 0.0; 30 | } 31 | 32 | //PLUGIN_EXPORT LPCWSTR GetString(void* data) 33 | //{ 34 | // Measure* measure = (Measure*)data; 35 | // return L""; 36 | //} 37 | 38 | //PLUGIN_EXPORT void ExecuteBang(void* data, LPCWSTR args) 39 | //{ 40 | // Measure* measure = (Measure*)data; 41 | //} 42 | 43 | //PLUGIN_EXPORT LPCWSTR (void* data, const int argc, const WCHAR* argv[]) 44 | //{ 45 | // Measure* measure = (Measure*)data; 46 | // return nullptr; 47 | //} 48 | 49 | PLUGIN_EXPORT void Finalize(void* data) 50 | { 51 | Measure* measure = (Measure*)data; 52 | delete measure; 53 | } 54 | -------------------------------------------------------------------------------- /C++/PluginEmpty/PluginEmpty.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rainmeter/rainmeter-plugin-sdk/1c36b22c77c739d23ee0411442b007f46298f154/C++/PluginEmpty/PluginEmpty.rc -------------------------------------------------------------------------------- /C++/PluginEmpty/PluginEmpty.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Release 14 | Win32 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | {64FDEE97-6B7E-40E5-A489-ECA322825BC8} 29 | Win32Proj 30 | PluginEmpty 31 | 10.0 32 | 33 | 34 | 35 | DynamicLibrary 36 | true 37 | Unicode 38 | v143 39 | 40 | 41 | DynamicLibrary 42 | true 43 | Unicode 44 | v143 45 | 46 | 47 | DynamicLibrary 48 | false 49 | true 50 | Unicode 51 | v143 52 | 53 | 54 | DynamicLibrary 55 | false 56 | true 57 | Unicode 58 | v143 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | true 78 | Empty 79 | x32\$(Configuration)\ 80 | x32\$(Configuration)\ 81 | 82 | 83 | true 84 | Empty 85 | x64\$(Configuration)\ 86 | x64\$(Configuration)\ 87 | 88 | 89 | false 90 | Empty 91 | x32\$(Configuration)\ 92 | x32\$(Configuration)\ 93 | 94 | 95 | false 96 | Empty 97 | x64\$(Configuration)\ 98 | x64\$(Configuration)\ 99 | 100 | 101 | 102 | 103 | 104 | Level3 105 | Disabled 106 | WIN32;_DEBUG;_WINDOWS;_USRDLL;PLUGINEMPTY_EXPORTS;%(PreprocessorDefinitions) 107 | MultiThreadedDebug 108 | 109 | 110 | true 111 | ..\..\API\x32\Rainmeter.lib;%(AdditionalDependencies) 112 | Windows 113 | 114 | 115 | 116 | 117 | 118 | 119 | Level3 120 | Disabled 121 | WIN32;_DEBUG;_WINDOWS;_USRDLL;PLUGINEMPTY_EXPORTS;%(PreprocessorDefinitions) 122 | MultiThreadedDebug 123 | 124 | 125 | true 126 | ..\..\API\x64\Rainmeter.lib;%(AdditionalDependencies) 127 | Windows 128 | 129 | 130 | _WIN64;%(PreprocessorDefinitions) 131 | 132 | 133 | 134 | 135 | Level3 136 | 137 | 138 | MaxSpeed 139 | true 140 | true 141 | WIN32;NDEBUG;_WINDOWS;_USRDLL;PLUGINEMPTY_EXPORTS;%(PreprocessorDefinitions) 142 | MultiThreaded 143 | 144 | 145 | false 146 | true 147 | .rdata=.text 148 | true 149 | ..\..\API\x32\Rainmeter.lib;%(AdditionalDependencies) 150 | Windows 151 | 152 | 153 | 154 | 155 | Level3 156 | 157 | 158 | MaxSpeed 159 | true 160 | true 161 | WIN32;NDEBUG;_WINDOWS;_USRDLL;PLUGINEMPTY_EXPORTS;%(PreprocessorDefinitions) 162 | MultiThreaded 163 | 164 | 165 | false 166 | true 167 | .rdata=.text 168 | true 169 | ..\..\API\x64\Rainmeter.lib;%(AdditionalDependencies) 170 | Windows 171 | 172 | 173 | _WIN64;%(PreprocessorDefinitions) 174 | 175 | 176 | 177 | 178 | 179 | -------------------------------------------------------------------------------- /C++/PluginEmpty/PluginEmpty.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /C++/PluginParentChild/PluginParentChild.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 Rainmeter Project Developers 2 | * 3 | * This Source Code Form is subject to the terms of the GNU General Public 4 | * License; either version 2 of the License, or (at your option) any later 5 | * version. If a copy of the GPL was not distributed with this file, You can 6 | * obtain one at . */ 7 | 8 | #include 9 | #include "../../API/RainmeterAPI.h" 10 | #include 11 | #include 12 | 13 | // Overview: This example demonstrates a basic implementation of a parent/child 14 | // measure structure. In this particular example, we have a "parent" measure 15 | // which contains the values for the options "ValueA", "ValueB", and "ValueC". 16 | // The child measures are used to return a specific value from the parent. 17 | 18 | // Use case: You could, for example, have a "main" parent measure that queries 19 | // information from some data set. The child measures can then be used to return 20 | // specific information from the data queried by the parent measure. 21 | 22 | // Sample skin: 23 | /* 24 | [Rainmeter] 25 | Update=1000 26 | DynamicWindowSize=1 27 | BackgroundMode=2 28 | SolidColor=255,255,255 29 | 30 | [mParent] 31 | Measure=Plugin 32 | Plugin=ParentChild 33 | ValueA=111 34 | ValueB=222 35 | ValueC=333 36 | Type=A 37 | 38 | [mChild1] 39 | Measure=Plugin 40 | Plugin=ParentChild 41 | ParentName=mParent 42 | Type=B 43 | 44 | [mChild2] 45 | Measure=Plugin 46 | Plugin=ParentChild 47 | ParentName=mParent 48 | Type=C 49 | 50 | [Text] 51 | Meter=String 52 | MeasureName=mParent 53 | MeasureName2=mChild1 54 | MeasureName3=mChild2 55 | Text="mParent: %1#CRLF#mChild1: %2#CRLF#mChild2: %3" 56 | */ 57 | 58 | enum MeasureType 59 | { 60 | MEASURE_A, 61 | MEASURE_B, 62 | MEASURE_C 63 | }; 64 | 65 | struct ChildMeasure; 66 | 67 | struct ParentMeasure 68 | { 69 | void* skin; 70 | LPCWSTR name; 71 | ChildMeasure* ownerChild; 72 | 73 | int valueA; 74 | int valueB; 75 | int valueC; 76 | 77 | ParentMeasure() : 78 | skin(nullptr), 79 | name(nullptr), 80 | ownerChild(nullptr), 81 | valueA(0), 82 | valueB(0), 83 | valueC(0) {} 84 | }; 85 | 86 | struct ChildMeasure 87 | { 88 | MeasureType type; 89 | ParentMeasure* parent; 90 | 91 | ChildMeasure() : 92 | type(MEASURE_A), 93 | parent(nullptr) {} 94 | }; 95 | 96 | std::vector g_ParentMeasures; 97 | 98 | PLUGIN_EXPORT void Initialize(void** data, void* rm) 99 | { 100 | ChildMeasure* child = new ChildMeasure; 101 | *data = child; 102 | 103 | void* skin = RmGetSkin(rm); 104 | 105 | LPCWSTR parentName = RmReadString(rm, L"ParentName", L""); 106 | if (!*parentName) 107 | { 108 | child->parent = new ParentMeasure; 109 | child->parent->name = RmGetMeasureName(rm); 110 | child->parent->skin = skin; 111 | child->parent->ownerChild = child; 112 | g_ParentMeasures.push_back(child->parent); 113 | } 114 | else 115 | { 116 | // Find parent using name AND the skin handle to be sure that it's the right one 117 | std::vector::const_iterator iter = g_ParentMeasures.begin(); 118 | for ( ; iter != g_ParentMeasures.end(); ++iter) 119 | { 120 | if (_wcsicmp((*iter)->name, parentName) == 0 && 121 | (*iter)->skin == skin) 122 | { 123 | child->parent = (*iter); 124 | return; 125 | } 126 | } 127 | 128 | RmLog(rm, LOG_ERROR, L"Invalid \"ParentName\""); 129 | } 130 | } 131 | 132 | PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue) 133 | { 134 | ChildMeasure* child = (ChildMeasure*)data; 135 | ParentMeasure* parent = child->parent; 136 | 137 | if (!parent) 138 | { 139 | return; 140 | } 141 | 142 | // Read common options 143 | LPCWSTR type = RmReadString(rm, L"Type", L""); 144 | if (_wcsicmp(type, L"A") == 0) 145 | { 146 | child->type = MEASURE_A; 147 | } 148 | else if (_wcsicmp(type, L"B") == 0) 149 | { 150 | child->type = MEASURE_B; 151 | } 152 | else if (_wcsicmp(type, L"C") == 0) 153 | { 154 | child->type = MEASURE_C; 155 | } 156 | else 157 | { 158 | RmLog(rm, LOG_ERROR, L"Invalid \"Type\""); 159 | } 160 | 161 | // Read parent specific options 162 | if (parent->ownerChild == child) 163 | { 164 | parent->valueA = RmReadInt(rm, L"ValueA", 0); 165 | parent->valueB = RmReadInt(rm, L"ValueB", 0); 166 | parent->valueC = RmReadInt(rm, L"ValueC", 0); 167 | } 168 | } 169 | 170 | PLUGIN_EXPORT double Update(void* data) 171 | { 172 | ChildMeasure* child = (ChildMeasure*)data; 173 | ParentMeasure* parent = child->parent; 174 | 175 | if (!parent) 176 | { 177 | return 0.0; 178 | } 179 | 180 | switch (child->type) 181 | { 182 | case MEASURE_A: 183 | return (double)parent->valueA; 184 | 185 | case MEASURE_B: 186 | return (double)parent->valueB; 187 | 188 | case MEASURE_C: 189 | return (double)parent->valueC; 190 | } 191 | 192 | return 0.0; 193 | } 194 | 195 | PLUGIN_EXPORT void Finalize(void* data) 196 | { 197 | ChildMeasure* child = (ChildMeasure*)data; 198 | ParentMeasure* parent = child->parent; 199 | 200 | if (parent && parent->ownerChild == child) 201 | { 202 | g_ParentMeasures.erase( 203 | std::remove(g_ParentMeasures.begin(),g_ParentMeasures.end(),parent), 204 | g_ParentMeasures.end()); 205 | delete parent; 206 | } 207 | 208 | delete child; 209 | } 210 | -------------------------------------------------------------------------------- /C++/PluginParentChild/PluginParentChild.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rainmeter/rainmeter-plugin-sdk/1c36b22c77c739d23ee0411442b007f46298f154/C++/PluginParentChild/PluginParentChild.rc -------------------------------------------------------------------------------- /C++/PluginParentChild/PluginParentChild.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Release 14 | Win32 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | {CDA75744-28E9-41CB-849E-BF9DD936C794} 29 | Win32Proj 30 | PluginParentChild 31 | 10.0 32 | 33 | 34 | 35 | DynamicLibrary 36 | true 37 | Unicode 38 | v143 39 | 40 | 41 | DynamicLibrary 42 | true 43 | Unicode 44 | v143 45 | 46 | 47 | DynamicLibrary 48 | false 49 | true 50 | Unicode 51 | v143 52 | 53 | 54 | DynamicLibrary 55 | false 56 | true 57 | Unicode 58 | v143 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | true 78 | ParentChild 79 | x32\$(Configuration)\ 80 | x32\$(Configuration)\ 81 | 82 | 83 | true 84 | ParentChild 85 | x64\$(Configuration)\ 86 | x64\$(Configuration)\ 87 | 88 | 89 | false 90 | ParentChild 91 | x32\$(Configuration)\ 92 | x32\$(Configuration)\ 93 | 94 | 95 | false 96 | ParentChild 97 | x64\$(Configuration)\ 98 | x64\$(Configuration)\ 99 | 100 | 101 | 102 | 103 | 104 | Level3 105 | Disabled 106 | WIN32;_DEBUG;_WINDOWS;_USRDLL;PluginParentChild_EXPORTS;%(PreprocessorDefinitions) 107 | MultiThreadedDebug 108 | 109 | 110 | true 111 | ..\..\API\x32\Rainmeter.lib;%(AdditionalDependencies) 112 | Windows 113 | 114 | 115 | 116 | 117 | 118 | 119 | Level3 120 | Disabled 121 | WIN32;_DEBUG;_WINDOWS;_USRDLL;PluginParentChild_EXPORTS;%(PreprocessorDefinitions) 122 | MultiThreadedDebug 123 | 124 | 125 | true 126 | ..\..\API\x64\Rainmeter.lib;%(AdditionalDependencies) 127 | Windows 128 | 129 | 130 | _WIN64;%(PreprocessorDefinitions) 131 | 132 | 133 | 134 | 135 | Level3 136 | 137 | 138 | MaxSpeed 139 | true 140 | true 141 | WIN32;NDEBUG;_WINDOWS;_USRDLL;PluginParentChild_EXPORTS;%(PreprocessorDefinitions) 142 | MultiThreaded 143 | 144 | 145 | false 146 | true 147 | .rdata=.text 148 | true 149 | ..\..\API\x32\Rainmeter.lib;%(AdditionalDependencies) 150 | Windows 151 | 152 | 153 | 154 | 155 | Level3 156 | 157 | 158 | MaxSpeed 159 | true 160 | true 161 | WIN32;NDEBUG;_WINDOWS;_USRDLL;PluginParentChild_EXPORTS;%(PreprocessorDefinitions) 162 | MultiThreaded 163 | 164 | 165 | false 166 | true 167 | .rdata=.text 168 | true 169 | ..\..\API\x64\Rainmeter.lib;%(AdditionalDependencies) 170 | Windows 171 | 172 | 173 | _WIN64;%(PreprocessorDefinitions) 174 | 175 | 176 | 177 | 178 | 179 | -------------------------------------------------------------------------------- /C++/PluginParentChild/PluginParentChild.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /C++/PluginRmExecute/PluginRmExecute.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 Rainmeter Project Developers 2 | * 3 | * This Source Code Form is subject to the terms of the GNU General Public 4 | * License; either version 2 of the License, or (at your option) any later 5 | * version. If a copy of the GPL was not distributed with this file, You can 6 | * obtain one at . */ 7 | 8 | #include 9 | #include "../../API/RainmeterAPI.h" 10 | #include 11 | #include 12 | 13 | // Overview: This is an example of how to make an option be read and execute the bang within. 14 | 15 | // Sample skin: 16 | /* 17 | [Rainmeter] 18 | Update=1000 19 | DynamicWindowSize=1 20 | BackgroundMode=2 21 | SolidColor=255,255,255 22 | 23 | [Variables] 24 | Count=0 25 | Timer=5 26 | 27 | [mTimer] 28 | Measure=Plugin 29 | Plugin=RmExecute 30 | Timer=#Timer# 31 | OnTimer=[!SetOption Example1 Text "This text has changed!"] 32 | 33 | [mTimer2] 34 | Measure=Plugin 35 | Plugin=RmExecute 36 | Timer=#Timer# 37 | OnTimer=[!SetVariable Count "(#Count# + 1)"] 38 | DynamicVariables=1 39 | 40 | [Example1] 41 | Meter=String 42 | Text=This text has not changed yet. 43 | 44 | [Example2] 45 | Meter=String 46 | Y=5R 47 | Text=This text has been updated #Count# times. 48 | DynamicVariables=1 49 | */ 50 | 51 | struct Measure 52 | { 53 | std::wstring command; 54 | double updateRate; 55 | time_t timer; 56 | 57 | void* skin; // Pointer to the skin (needed for RmExecute) 58 | 59 | Measure() : 60 | command(), 61 | updateRate(0), 62 | timer(std::time(nullptr)), // You can also do this in the Initalize function 63 | skin(nullptr) {} 64 | }; 65 | 66 | PLUGIN_EXPORT void Initialize(void** data, void* rm) 67 | { 68 | Measure* measure = new Measure; 69 | *data = measure; 70 | 71 | measure->skin = RmGetSkin(rm); 72 | } 73 | 74 | PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue) 75 | { 76 | Measure* measure = (Measure*)data; 77 | measure->updateRate = RmReadDouble(rm, L"Timer", 1.0); 78 | 79 | // When reading an action, do not replace any section variables in the option so 80 | // that when the action is executed, the most recent value of the measure will be 81 | // used. Note the boolean parameter. 82 | measure->command = RmReadString(rm, L"OnTimer", L"", FALSE); 83 | } 84 | 85 | PLUGIN_EXPORT double Update(void* data) 86 | { 87 | Measure* measure = (Measure*)data; 88 | 89 | double difference = std::difftime(time(nullptr), measure->timer); 90 | if (difference >= measure->updateRate) 91 | { 92 | RmExecute(measure->skin, measure->command.c_str()); 93 | measure->timer = std::time(nullptr); 94 | } 95 | 96 | return measure->updateRate - difference; 97 | } 98 | 99 | PLUGIN_EXPORT void Finalize(void* data) 100 | { 101 | Measure* measure = (Measure*)data; 102 | delete measure; 103 | } 104 | -------------------------------------------------------------------------------- /C++/PluginRmExecute/PluginRmExecute.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rainmeter/rainmeter-plugin-sdk/1c36b22c77c739d23ee0411442b007f46298f154/C++/PluginRmExecute/PluginRmExecute.rc -------------------------------------------------------------------------------- /C++/PluginRmExecute/PluginRmExecute.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Release 14 | Win32 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | {31ACF3A1-2547-4CD1-9200-EF3E665B07BC} 29 | Win32Proj 30 | PluginRmExecute 31 | 10.0 32 | 33 | 34 | 35 | DynamicLibrary 36 | true 37 | Unicode 38 | v143 39 | 40 | 41 | DynamicLibrary 42 | true 43 | Unicode 44 | v143 45 | 46 | 47 | DynamicLibrary 48 | false 49 | true 50 | Unicode 51 | v143 52 | 53 | 54 | DynamicLibrary 55 | false 56 | true 57 | Unicode 58 | v143 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | true 78 | RmExecute 79 | x32\$(Configuration)\ 80 | x32\$(Configuration)\ 81 | 82 | 83 | true 84 | RmExecute 85 | x64\$(Configuration)\ 86 | x64\$(Configuration)\ 87 | 88 | 89 | false 90 | RmExecute 91 | x32\$(Configuration)\ 92 | x32\$(Configuration)\ 93 | 94 | 95 | false 96 | RmExecute 97 | x64\$(Configuration)\ 98 | x64\$(Configuration)\ 99 | 100 | 101 | 102 | 103 | 104 | Level3 105 | Disabled 106 | WIN32;_DEBUG;_WINDOWS;_USRDLL;PLUGINRmExecute_EXPORTS;%(PreprocessorDefinitions) 107 | MultiThreadedDebug 108 | 109 | 110 | true 111 | ..\..\API\x32\Rainmeter.lib;%(AdditionalDependencies) 112 | Windows 113 | 114 | 115 | 116 | 117 | 118 | 119 | Level3 120 | Disabled 121 | WIN32;_DEBUG;_WINDOWS;_USRDLL;PLUGINRmExecute_EXPORTS;%(PreprocessorDefinitions) 122 | MultiThreadedDebug 123 | 124 | 125 | true 126 | ..\..\API\x64\Rainmeter.lib;%(AdditionalDependencies) 127 | Windows 128 | 129 | 130 | _WIN64;%(PreprocessorDefinitions) 131 | 132 | 133 | 134 | 135 | Level3 136 | 137 | 138 | MaxSpeed 139 | true 140 | true 141 | WIN32;NDEBUG;_WINDOWS;_USRDLL;PLUGINRmExecute_EXPORTS;%(PreprocessorDefinitions) 142 | MultiThreaded 143 | 144 | 145 | false 146 | true 147 | .rdata=.text 148 | true 149 | ..\..\API\x32\Rainmeter.lib;%(AdditionalDependencies) 150 | Windows 151 | 152 | 153 | 154 | 155 | Level3 156 | 157 | 158 | MaxSpeed 159 | true 160 | true 161 | WIN32;NDEBUG;_WINDOWS;_USRDLL;PLUGINRmExecute_EXPORTS;%(PreprocessorDefinitions) 162 | MultiThreaded 163 | 164 | 165 | false 166 | true 167 | .rdata=.text 168 | true 169 | ..\..\API\x64\Rainmeter.lib;%(AdditionalDependencies) 170 | Windows 171 | 172 | 173 | _WIN64;%(PreprocessorDefinitions) 174 | 175 | 176 | 177 | 178 | 179 | -------------------------------------------------------------------------------- /C++/PluginRmExecute/PluginRmExecute.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /C++/PluginSectionVariables/PluginSectionVariables.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 Rainmeter Project Developers 2 | * 3 | * This Source Code Form is subject to the terms of the GNU General Public 4 | * License; either version 2 of the License, or (at your option) any later 5 | * version. If a copy of the GPL was not distributed with this file, You can 6 | * obtain one at . */ 7 | 8 | #include 9 | #include "../../API/RainmeterAPI.h" 10 | #include 11 | #include 12 | #include 13 | 14 | // Overview: This example demonstrates using plugin section variables. 15 | // In this example we build a ToUpper and a ToLower section variable that can either get the measure text 16 | // or transform the string passed to uppercase/lowercase 17 | 18 | // Sample skin: 19 | /* 20 | [Rainmeter] 21 | Update=1000 22 | DynamicWindowSize=1 23 | BackgroundMode=2 24 | SolidColor=255,255,255 25 | 26 | [Variables] 27 | TextString=click me to make me uppercase! 28 | 29 | [mString] 30 | Measure=Plugin 31 | Plugin=SectionVariables 32 | Input=I AM A SECTION VARIABLE! 33 | 34 | [TextLower] 35 | Meter=String 36 | Text=[mString:ToLower()] 37 | 38 | ; Because regular options will replace section variables when 39 | ; read, DynamicVariables is required in this case. 40 | DynamicVariables=1 41 | 42 | [TextUpper] 43 | Meter=String 44 | Y=5R 45 | Text=#TextString# 46 | 47 | ; Because actions do not replace section variables when read, DynamicVariables=1 is not needed 48 | LeftMouseUpAction=[!SetOption TextUpper Text "[mString:ToUpper(#TextString#)]"] 49 | */ 50 | 51 | struct Measure 52 | { 53 | std::wstring inputStr; 54 | std::wstring buffer; 55 | 56 | Measure() : 57 | inputStr(), 58 | buffer() {} 59 | }; 60 | 61 | PLUGIN_EXPORT void Initialize(void** data, void* rm) 62 | { 63 | Measure* measure = new Measure; 64 | *data = measure; 65 | } 66 | 67 | PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue) 68 | { 69 | Measure* measure = (Measure*)data; 70 | measure->inputStr = RmReadString(rm, L"Input", L""); 71 | } 72 | 73 | PLUGIN_EXPORT double Update(void* data) 74 | { 75 | Measure* measure = (Measure*)data; 76 | return 0.0; 77 | } 78 | 79 | PLUGIN_EXPORT LPCWSTR GetString(void* data) 80 | { 81 | Measure* measure = (Measure*)data; 82 | return measure->inputStr.c_str(); // Might be an empty string if no |Input| option is defined 83 | } 84 | 85 | PLUGIN_EXPORT LPCWSTR ToUpper(void* data, const int argc, const WCHAR* argv[]) 86 | { 87 | Measure* measure = (Measure*)data; 88 | 89 | //If there was an argument passed to the function transform that 90 | if (argc > 0) 91 | { 92 | measure->buffer = argv[0]; // Only transform the first argument 93 | } 94 | //Else transform the |Input| option 95 | else 96 | { 97 | measure->buffer = measure->inputStr; 98 | } 99 | 100 | std::transform(measure->buffer.begin(), measure->buffer.end(), measure->buffer.begin(), std::towupper); 101 | return measure->buffer.c_str(); 102 | } 103 | 104 | PLUGIN_EXPORT LPCWSTR ToLower(void* data, const int argc, const WCHAR* argv[]) 105 | { 106 | Measure* measure = (Measure*)data; 107 | 108 | //If there was an argument passed to the function transform that 109 | if (argc > 0) 110 | { 111 | measure->buffer = argv[0]; // Only transform the first argument 112 | } 113 | //Else transform the |Input| option 114 | else 115 | { 116 | measure->buffer = measure->inputStr; 117 | } 118 | 119 | std::transform(measure->buffer.begin(), measure->buffer.end(), measure->buffer.begin(), std::towlower); 120 | return measure->buffer.c_str(); 121 | } 122 | 123 | PLUGIN_EXPORT void Finalize(void* data) 124 | { 125 | Measure* measure = (Measure*)data; 126 | delete measure; 127 | } 128 | -------------------------------------------------------------------------------- /C++/PluginSectionVariables/PluginSectionVariables.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rainmeter/rainmeter-plugin-sdk/1c36b22c77c739d23ee0411442b007f46298f154/C++/PluginSectionVariables/PluginSectionVariables.rc -------------------------------------------------------------------------------- /C++/PluginSectionVariables/PluginSectionVariables.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Release 14 | Win32 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | {da0c1f65-a686-4741-af21-32097240fd2e} 29 | Win32Proj 30 | PluginSectionVariables 31 | 10.0 32 | 33 | 34 | 35 | DynamicLibrary 36 | true 37 | Unicode 38 | v143 39 | 40 | 41 | DynamicLibrary 42 | true 43 | Unicode 44 | v143 45 | 46 | 47 | DynamicLibrary 48 | false 49 | true 50 | Unicode 51 | v143 52 | 53 | 54 | DynamicLibrary 55 | false 56 | true 57 | Unicode 58 | v143 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | true 78 | SectionVariables 79 | x32\$(Configuration)\ 80 | x32\$(Configuration)\ 81 | 82 | 83 | true 84 | SectionVariables 85 | x64\$(Configuration)\ 86 | x64\$(Configuration)\ 87 | 88 | 89 | false 90 | SectionVariables 91 | x32\$(Configuration)\ 92 | x32\$(Configuration)\ 93 | 94 | 95 | false 96 | SectionVariables 97 | x64\$(Configuration)\ 98 | x64\$(Configuration)\ 99 | 100 | 101 | 102 | 103 | 104 | Level3 105 | Disabled 106 | WIN32;_DEBUG;_WINDOWS;_USRDLL;PLUGINSectionVariables_EXPORTS;%(PreprocessorDefinitions) 107 | MultiThreadedDebug 108 | 109 | 110 | true 111 | ..\..\API\x32\Rainmeter.lib;%(AdditionalDependencies) 112 | Windows 113 | 114 | 115 | 116 | 117 | 118 | 119 | Level3 120 | Disabled 121 | WIN32;_DEBUG;_WINDOWS;_USRDLL;PLUGINSectionVariables_EXPORTS;%(PreprocessorDefinitions) 122 | MultiThreadedDebug 123 | 124 | 125 | true 126 | ..\..\API\x64\Rainmeter.lib;%(AdditionalDependencies) 127 | Windows 128 | 129 | 130 | _WIN64;%(PreprocessorDefinitions) 131 | 132 | 133 | 134 | 135 | Level3 136 | 137 | 138 | MaxSpeed 139 | true 140 | true 141 | WIN32;NDEBUG;_WINDOWS;_USRDLL;PLUGINSectionVariables_EXPORTS;%(PreprocessorDefinitions) 142 | MultiThreaded 143 | 144 | 145 | false 146 | true 147 | .rdata=.text 148 | true 149 | ..\..\API\x32\Rainmeter.lib;%(AdditionalDependencies) 150 | Windows 151 | 152 | 153 | 154 | 155 | Level3 156 | 157 | 158 | MaxSpeed 159 | true 160 | true 161 | WIN32;NDEBUG;_WINDOWS;_USRDLL;PLUGINSectionVariables_EXPORTS;%(PreprocessorDefinitions) 162 | MultiThreaded 163 | 164 | 165 | false 166 | true 167 | .rdata=.text 168 | true 169 | ..\..\API\x64\Rainmeter.lib;%(AdditionalDependencies) 170 | Windows 171 | 172 | 173 | _WIN64;%(PreprocessorDefinitions) 174 | 175 | 176 | 177 | 178 | 179 | -------------------------------------------------------------------------------- /C++/PluginSectionVariables/PluginSectionVariables.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /C++/PluginSystemVersion/PluginSystemVersion.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 Rainmeter Project Developers 2 | * 3 | * This Source Code Form is subject to the terms of the GNU General Public 4 | * License; either version 2 of the License, or (at your option) any later 5 | * version. If a copy of the GPL was not distributed with this file, You can 6 | * obtain one at . */ 7 | 8 | #include 9 | #include 10 | #include 11 | #include "../../API/RainmeterAPI.h" 12 | 13 | // Overview: This example demonstrates the basic concept of Rainmeter C++ plugins. 14 | 15 | // Sample skin: 16 | /* 17 | [Rainmeter] 18 | Update=1000 19 | DynamicWindowSize=1 20 | BackgroundMode=2 21 | SolidColor=255,255,255 22 | 23 | [mString] 24 | Measure=Plugin 25 | Plugin=SystemVersion 26 | Type=String 27 | 28 | [mMajor] 29 | Measure=Plugin 30 | Plugin=SystemVersion 31 | Type=Major 32 | 33 | [mMinor] 34 | Measure=Plugin 35 | Plugin=SystemVersion 36 | Type=Minor 37 | 38 | [mNumber] 39 | Measure=Plugin 40 | Plugin=SystemVersion 41 | Type=Number 42 | 43 | [Text1] 44 | Meter=String 45 | MeasureName=mString 46 | MeasureName2=mMajor 47 | MeasureName3=mMinor 48 | MeasureName4=mNumber 49 | Text="String: %1#CRLF#Major: %2#CRLF#Minor: %3#CRLF#Number: %4#CRLF#" 50 | 51 | [Text2] 52 | Meter=String 53 | MeasureName=mString 54 | MeasureName2=mMajor 55 | MeasureName3=mMinor 56 | MeasureName4=mNumber 57 | NumOfDecimals=1 58 | Y=5R 59 | Text="String: %1#CRLF#Major: %2#CRLF#Minor: %3#CRLF#Number: %4#CRLF#" 60 | */ 61 | 62 | enum MeasureType 63 | { 64 | MEASURE_MAJOR, 65 | MEASURE_MINOR, 66 | MEASURE_NUMBER, 67 | MEASURE_STRING 68 | }; 69 | 70 | struct Measure 71 | { 72 | MeasureType type; 73 | std::wstring strValue; 74 | 75 | Measure() : 76 | type(MEASURE_MAJOR), 77 | strValue() {} 78 | }; 79 | 80 | PLUGIN_EXPORT void Initialize(void** data, void* rm) 81 | { 82 | Measure* measure = new Measure; 83 | *data = measure; 84 | } 85 | 86 | PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue) 87 | { 88 | Measure* measure = (Measure*)data; 89 | 90 | LPCWSTR value = RmReadString(rm, L"Type", L""); 91 | if (_wcsicmp(value, L"Major") == 0) 92 | { 93 | measure->type = MEASURE_MAJOR; 94 | } 95 | else if (_wcsicmp(value, L"Minor") == 0) 96 | { 97 | measure->type = MEASURE_MINOR; 98 | } 99 | else if (_wcsicmp(value, L"Number") == 0) 100 | { 101 | measure->type = MEASURE_NUMBER; 102 | } 103 | else if (_wcsicmp(value, L"String") == 0) 104 | { 105 | measure->type = MEASURE_STRING; 106 | } 107 | else 108 | { 109 | RmLog(rm, LOG_ERROR, L"Invalid \"Type\""); 110 | } 111 | } 112 | 113 | PLUGIN_EXPORT double Update(void* data) 114 | { 115 | Measure* measure = (Measure*)data; 116 | 117 | OSVERSIONINFOEX osvi = {sizeof(OSVERSIONINFOEX)}; 118 | if (!GetVersionEx((OSVERSIONINFO*)&osvi)) 119 | { 120 | return 0.0; 121 | } 122 | 123 | switch (measure->type) 124 | { 125 | case MEASURE_MINOR: 126 | return (double)osvi.dwMinorVersion; 127 | 128 | case MEASURE_MAJOR: 129 | return (double)osvi.dwMajorVersion; 130 | 131 | case MEASURE_NUMBER: 132 | return (double)osvi.dwMajorVersion + ((double)osvi.dwMinorVersion / 10.0); 133 | 134 | case MEASURE_STRING: 135 | { 136 | WCHAR buffer[128]; 137 | _snwprintf_s(buffer, _TRUNCATE, L"%i.%i (Build %i)", 138 | (int)osvi.dwMajorVersion, (int)osvi.dwMinorVersion, (int)osvi.dwBuildNumber); 139 | measure->strValue = buffer; 140 | } 141 | break; 142 | } 143 | 144 | // MEASURE_STRING is not a number and therefore will be returned in GetString. However it is 145 | // recommended that you do any processing here in the Update function rather than the GetString 146 | // function since GetString can be called multiple times during the update cycle. Store any 147 | // string values in your Measure structure and return it in GetString. 148 | 149 | return 0.0; 150 | } 151 | 152 | PLUGIN_EXPORT LPCWSTR GetString(void* data) 153 | { 154 | Measure* measure = (Measure*)data; 155 | 156 | // Although GetVersionEx is a rather inexpensive operation, it is recommended to 157 | // do any processing in the Update function. See the comments above. 158 | if (!measure->strValue.empty()) 159 | { 160 | switch (measure->type) 161 | { 162 | case MEASURE_STRING: 163 | return measure->strValue.c_str(); 164 | } 165 | } 166 | 167 | // MEASURE_MAJOR, MEASURE_MINOR, and MEASURE_NUMBER are numbers. Therefore, 168 | // |nullptr| is returned here for them. This is to inform Rainmeter that it can 169 | // treat those types as numbers. 170 | 171 | return nullptr; 172 | } 173 | 174 | PLUGIN_EXPORT void Finalize(void* data) 175 | { 176 | Measure* measure = (Measure*)data; 177 | delete measure; 178 | } 179 | -------------------------------------------------------------------------------- /C++/PluginSystemVersion/PluginSystemVersion.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rainmeter/rainmeter-plugin-sdk/1c36b22c77c739d23ee0411442b007f46298f154/C++/PluginSystemVersion/PluginSystemVersion.rc -------------------------------------------------------------------------------- /C++/PluginSystemVersion/PluginSystemVersion.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Release 14 | Win32 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | {7FB00A1C-F0C0-49FD-A15C-392F69FDF645} 29 | Win32Proj 30 | PluginSystemVersion 31 | 10.0 32 | 33 | 34 | 35 | DynamicLibrary 36 | true 37 | Unicode 38 | v143 39 | 40 | 41 | DynamicLibrary 42 | true 43 | Unicode 44 | v143 45 | 46 | 47 | DynamicLibrary 48 | false 49 | true 50 | Unicode 51 | v143 52 | 53 | 54 | DynamicLibrary 55 | false 56 | true 57 | Unicode 58 | v143 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | true 78 | SystemVersion 79 | x32\$(Configuration)\ 80 | x32\$(Configuration)\ 81 | 82 | 83 | true 84 | SystemVersion 85 | x64\$(Configuration)\ 86 | x64\$(Configuration)\ 87 | 88 | 89 | false 90 | SystemVersion 91 | x32\$(Configuration)\ 92 | x32\$(Configuration)\ 93 | 94 | 95 | false 96 | SystemVersion 97 | x64\$(Configuration)\ 98 | x64\$(Configuration)\ 99 | 100 | 101 | 102 | 103 | 104 | Level3 105 | Disabled 106 | WIN32;_DEBUG;_WINDOWS;_USRDLL;PluginSystemVersion_EXPORTS;%(PreprocessorDefinitions) 107 | MultiThreadedDebug 108 | 109 | 110 | true 111 | ..\..\API\x32\Rainmeter.lib;%(AdditionalDependencies) 112 | Windows 113 | 114 | 115 | 116 | 117 | 118 | 119 | Level3 120 | Disabled 121 | WIN32;_DEBUG;_WINDOWS;_USRDLL;PluginSystemVersion_EXPORTS;%(PreprocessorDefinitions) 122 | MultiThreadedDebug 123 | 124 | 125 | true 126 | ..\..\API\x64\Rainmeter.lib;%(AdditionalDependencies) 127 | Windows 128 | 129 | 130 | _WIN64;%(PreprocessorDefinitions) 131 | 132 | 133 | 134 | 135 | Level3 136 | 137 | 138 | MaxSpeed 139 | true 140 | true 141 | WIN32;NDEBUG;_WINDOWS;_USRDLL;PluginSystemVersion_EXPORTS;%(PreprocessorDefinitions) 142 | MultiThreaded 143 | 144 | 145 | false 146 | true 147 | .rdata=.text 148 | true 149 | ..\..\API\x32\Rainmeter.lib;%(AdditionalDependencies) 150 | Windows 151 | 152 | 153 | 154 | 155 | Level3 156 | 157 | 158 | MaxSpeed 159 | true 160 | true 161 | WIN32;NDEBUG;_WINDOWS;_USRDLL;PluginSystemVersion_EXPORTS;%(PreprocessorDefinitions) 162 | MultiThreaded 163 | 164 | 165 | false 166 | true 167 | .rdata=.text 168 | true 169 | ..\..\API\x64\Rainmeter.lib;%(AdditionalDependencies) 170 | Windows 171 | 172 | 173 | _WIN64;%(PreprocessorDefinitions) 174 | 175 | 176 | 177 | 178 | 179 | -------------------------------------------------------------------------------- /C++/PluginSystemVersion/PluginSystemVersion.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /C++/SDK-CPP.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 16 4 | VisualStudioVersion = 16.0.29201.188 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PluginEmpty", "PluginEmpty\PluginEmpty.vcxproj", "{64FDEE97-6B7E-40E5-A489-ECA322825BC8}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PluginSystemVersion", "PluginSystemVersion\PluginSystemVersion.vcxproj", "{7FB00A1C-F0C0-49FD-A15C-392F69FDF645}" 9 | EndProject 10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PluginParentChild", "PluginParentChild\PluginParentChild.vcxproj", "{CDA75744-28E9-41CB-849E-BF9DD936C794}" 11 | EndProject 12 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PluginSectionVariables", "PluginSectionVariables\PluginSectionVariables.vcxproj", "{DA0C1F65-A686-4741-AF21-32097240FD2E}" 13 | EndProject 14 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PluginDataHandling", "PluginDataHandling\PluginDataHandling.vcxproj", "{8CAA57CE-289D-4365-AC1F-0C6E3E5B76B8}" 15 | EndProject 16 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PluginRmExecute", "PluginRmExecute\PluginRmExecute.vcxproj", "{31ACF3A1-2547-4CD1-9200-EF3E665B07BC}" 17 | EndProject 18 | Global 19 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 20 | Debug|Win32 = Debug|Win32 21 | Debug|x64 = Debug|x64 22 | Release|Win32 = Release|Win32 23 | Release|x64 = Release|x64 24 | EndGlobalSection 25 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 26 | {64FDEE97-6B7E-40E5-A489-ECA322825BC8}.Debug|Win32.ActiveCfg = Debug|Win32 27 | {64FDEE97-6B7E-40E5-A489-ECA322825BC8}.Debug|Win32.Build.0 = Debug|Win32 28 | {64FDEE97-6B7E-40E5-A489-ECA322825BC8}.Debug|x64.ActiveCfg = Debug|x64 29 | {64FDEE97-6B7E-40E5-A489-ECA322825BC8}.Debug|x64.Build.0 = Debug|x64 30 | {64FDEE97-6B7E-40E5-A489-ECA322825BC8}.Release|Win32.ActiveCfg = Release|Win32 31 | {64FDEE97-6B7E-40E5-A489-ECA322825BC8}.Release|Win32.Build.0 = Release|Win32 32 | {64FDEE97-6B7E-40E5-A489-ECA322825BC8}.Release|x64.ActiveCfg = Release|x64 33 | {64FDEE97-6B7E-40E5-A489-ECA322825BC8}.Release|x64.Build.0 = Release|x64 34 | {7FB00A1C-F0C0-49FD-A15C-392F69FDF645}.Debug|Win32.ActiveCfg = Debug|Win32 35 | {7FB00A1C-F0C0-49FD-A15C-392F69FDF645}.Debug|Win32.Build.0 = Debug|Win32 36 | {7FB00A1C-F0C0-49FD-A15C-392F69FDF645}.Debug|x64.ActiveCfg = Debug|x64 37 | {7FB00A1C-F0C0-49FD-A15C-392F69FDF645}.Debug|x64.Build.0 = Debug|x64 38 | {7FB00A1C-F0C0-49FD-A15C-392F69FDF645}.Release|Win32.ActiveCfg = Release|Win32 39 | {7FB00A1C-F0C0-49FD-A15C-392F69FDF645}.Release|Win32.Build.0 = Release|Win32 40 | {7FB00A1C-F0C0-49FD-A15C-392F69FDF645}.Release|x64.ActiveCfg = Release|x64 41 | {7FB00A1C-F0C0-49FD-A15C-392F69FDF645}.Release|x64.Build.0 = Release|x64 42 | {CDA75744-28E9-41CB-849E-BF9DD936C794}.Debug|Win32.ActiveCfg = Debug|Win32 43 | {CDA75744-28E9-41CB-849E-BF9DD936C794}.Debug|Win32.Build.0 = Debug|Win32 44 | {CDA75744-28E9-41CB-849E-BF9DD936C794}.Debug|x64.ActiveCfg = Debug|x64 45 | {CDA75744-28E9-41CB-849E-BF9DD936C794}.Debug|x64.Build.0 = Debug|x64 46 | {CDA75744-28E9-41CB-849E-BF9DD936C794}.Release|Win32.ActiveCfg = Release|Win32 47 | {CDA75744-28E9-41CB-849E-BF9DD936C794}.Release|Win32.Build.0 = Release|Win32 48 | {CDA75744-28E9-41CB-849E-BF9DD936C794}.Release|x64.ActiveCfg = Release|x64 49 | {CDA75744-28E9-41CB-849E-BF9DD936C794}.Release|x64.Build.0 = Release|x64 50 | {DA0C1F65-A686-4741-AF21-32097240FD2E}.Debug|Win32.ActiveCfg = Debug|Win32 51 | {DA0C1F65-A686-4741-AF21-32097240FD2E}.Debug|Win32.Build.0 = Debug|Win32 52 | {DA0C1F65-A686-4741-AF21-32097240FD2E}.Debug|x64.ActiveCfg = Debug|x64 53 | {DA0C1F65-A686-4741-AF21-32097240FD2E}.Debug|x64.Build.0 = Debug|x64 54 | {DA0C1F65-A686-4741-AF21-32097240FD2E}.Release|Win32.ActiveCfg = Release|Win32 55 | {DA0C1F65-A686-4741-AF21-32097240FD2E}.Release|Win32.Build.0 = Release|Win32 56 | {DA0C1F65-A686-4741-AF21-32097240FD2E}.Release|x64.ActiveCfg = Release|x64 57 | {DA0C1F65-A686-4741-AF21-32097240FD2E}.Release|x64.Build.0 = Release|x64 58 | {8CAA57CE-289D-4365-AC1F-0C6E3E5B76B8}.Debug|Win32.ActiveCfg = Debug|Win32 59 | {8CAA57CE-289D-4365-AC1F-0C6E3E5B76B8}.Debug|Win32.Build.0 = Debug|Win32 60 | {8CAA57CE-289D-4365-AC1F-0C6E3E5B76B8}.Debug|x64.ActiveCfg = Debug|x64 61 | {8CAA57CE-289D-4365-AC1F-0C6E3E5B76B8}.Debug|x64.Build.0 = Debug|x64 62 | {8CAA57CE-289D-4365-AC1F-0C6E3E5B76B8}.Release|Win32.ActiveCfg = Release|Win32 63 | {8CAA57CE-289D-4365-AC1F-0C6E3E5B76B8}.Release|Win32.Build.0 = Release|Win32 64 | {8CAA57CE-289D-4365-AC1F-0C6E3E5B76B8}.Release|x64.ActiveCfg = Release|x64 65 | {8CAA57CE-289D-4365-AC1F-0C6E3E5B76B8}.Release|x64.Build.0 = Release|x64 66 | {31ACF3A1-2547-4CD1-9200-EF3E665B07BC}.Debug|Win32.ActiveCfg = Debug|Win32 67 | {31ACF3A1-2547-4CD1-9200-EF3E665B07BC}.Debug|Win32.Build.0 = Debug|Win32 68 | {31ACF3A1-2547-4CD1-9200-EF3E665B07BC}.Debug|x64.ActiveCfg = Debug|x64 69 | {31ACF3A1-2547-4CD1-9200-EF3E665B07BC}.Debug|x64.Build.0 = Debug|x64 70 | {31ACF3A1-2547-4CD1-9200-EF3E665B07BC}.Release|Win32.ActiveCfg = Release|Win32 71 | {31ACF3A1-2547-4CD1-9200-EF3E665B07BC}.Release|Win32.Build.0 = Release|Win32 72 | {31ACF3A1-2547-4CD1-9200-EF3E665B07BC}.Release|x64.ActiveCfg = Release|x64 73 | {31ACF3A1-2547-4CD1-9200-EF3E665B07BC}.Release|x64.Build.0 = Release|x64 74 | EndGlobalSection 75 | GlobalSection(SolutionProperties) = preSolution 76 | HideSolutionNode = FALSE 77 | EndGlobalSection 78 | GlobalSection(ExtensibilityGlobals) = postSolution 79 | SolutionGuid = {0BB5493F-241B-4D0D-B3C2-04F57BA7BA16} 80 | EndGlobalSection 81 | EndGlobal 82 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | The Rainmeter plugin software development kit contains the necessary tools and examples to build plugins in C/C++ and C#. Note that plugins built with the SDK require Rainmeter 4.5 or higher. 2 | 3 | **Download:** 4 | 5 | * Use git (`git clone git@github.com:rainmeter/rainmeter-plugin-sdk.git`) 6 | * Use svn (`svn checkout https://github.com/rainmeter/rainmeter-plugin-sdk/trunk rainmeter-plugin-sdk`) 7 | * Download the [current snapshot](https://github.com/rainmeter/rainmeter-plugin-sdk/zipball/master) as a .zip archive. 8 | 9 | The SDK can be built using any version of Visual Studio 2022. If you don't already have VS2022, you can download the free "Visual Studio Community" version [here](https://www.visualstudio.com/downloads/). 10 | 11 | **Documentation:** The documentation is available at https://docs.rainmeter.net/developers/. 12 | --------------------------------------------------------------------------------