Skip to content

Commit fd5cb56

Browse files
authored
Add files via upload
1 parent 4384041 commit fd5cb56

4 files changed

Lines changed: 95 additions & 0 deletions

File tree

MousePos/Main.ini

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[Rainmeter]
2+
Update=50
3+
BackGroundMode=2
4+
SolidColor=ffffff
5+
6+
[MeasureMouseX]
7+
Measure=Plugin
8+
Plugin=MousePos
9+
MeasureType=MouseX
10+
DynamicVariables=1
11+
12+
[MeasureMouseY]
13+
Measure=Plugin
14+
Plugin=MousePos
15+
MeasureType=MouseY
16+
DynamicVariables=1
17+
18+
[MeterMouseX]
19+
Meter=STRING
20+
X=10
21+
Y=10
22+
FontColor=10,10,10
23+
Text=Mouse X: [MeasureMouseX]
24+
DynamicVariables=1
25+
Antialias=1
26+
27+
[MeterMouseY]
28+
Meter=STRING
29+
X=10
30+
Y=30
31+
FontColor=10,10,10
32+
Text=Mouse Y: [MeasureMouseY]
33+
DynamicVariables=1
34+
Antialias=1

SourceCode.cs

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
using System;
2+
using System.Runtime.InteropServices;
3+
using System.Windows.Forms;
4+
using System.Drawing;
5+
using Rainmeter;
6+
7+
namespace MousePositionPlugin
8+
{
9+
public class Measure
10+
{
11+
private string type;
12+
13+
internal void Reload(API api, ref double maxValue)
14+
{
15+
type = api.ReadString("MeasureType", "MouseX").ToLowerInvariant();
16+
}
17+
18+
internal double Update()
19+
{
20+
if (type == "mousex")
21+
{
22+
return Cursor.Position.X;
23+
}
24+
else if (type == "mousey")
25+
{
26+
return Cursor.Position.Y;
27+
}
28+
29+
return 0.0;
30+
}
31+
}
32+
33+
public static class Plugin
34+
{
35+
[DllExport]
36+
public static void Initialize(ref IntPtr data, IntPtr rm)
37+
{
38+
data = GCHandle.ToIntPtr(GCHandle.Alloc(new Measure()));
39+
}
40+
41+
[DllExport]
42+
public static void Finalize(IntPtr data)
43+
{
44+
GCHandle.FromIntPtr(data).Free();
45+
}
46+
47+
[DllExport]
48+
public static void Reload(IntPtr data, IntPtr rm, ref double maxValue)
49+
{
50+
Measure measure = (Measure)GCHandle.FromIntPtr(data).Target;
51+
measure.Reload(new API(rm), ref maxValue);
52+
}
53+
54+
[DllExport]
55+
public static double Update(IntPtr data)
56+
{
57+
Measure measure = (Measure)GCHandle.FromIntPtr(data).Target;
58+
return measure.Update();
59+
}
60+
}
61+
}

x32/MousePos.dll

8 KB
Binary file not shown.

x64/MousePos.dll

8 KB
Binary file not shown.

0 commit comments

Comments
 (0)