Skip to content

Commit

Permalink
Minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
qt-kaneko committed May 3, 2024
1 parent 175ef82 commit 8cc2e41
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
5 changes: 2 additions & 3 deletions ReMOSD/src/MediaOsd.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Threading;

using Windows.Win32.Foundation;
Expand All @@ -24,13 +23,13 @@ public GDI_REGION_TYPE GetRegionBox(out RECT box)
public void SetRegion(HRGN value)
{
var result = SetWindowRgn(HWnd, value, true);
if (result == 0) throw new Win32Exception(Marshal.GetLastWin32Error());
if (result == 0) throw new Win32Exception();
}

public uint GetDpi()
{
var dpi = GetDpiForWindow(HWnd);
if (dpi == 0) throw new Win32Exception(Marshal.GetLastWin32Error());
if (dpi == 0) throw new Win32Exception();

return dpi;
}
Expand Down
2 changes: 1 addition & 1 deletion ReMOSD/src/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
newOsdRegion = CreateRectRgn(0, 0,
(int)Math.Round(65 * osdScalingCoefficient),
(int)Math.Round(140 * osdScalingCoefficient));
if (newOsdRegion == default) throw new Win32Exception(Marshal.GetLastWin32Error());
if (newOsdRegion == default) throw new Win32Exception();
}
else // Reset
{
Expand Down
2 changes: 1 addition & 1 deletion ReVOSD/src/MediaOsd.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public GDI_REGION_TYPE GetRegionBox(out RECT box)
public void SetRegion(HRGN value)
{
var result = SetWindowRgn(HWnd, value, true);
if (result == 0) throw new Win32Exception(Marshal.GetLastWin32Error());
if (result == 0) throw new Win32Exception();
}

public static MediaOsd Find()
Expand Down
2 changes: 1 addition & 1 deletion ReVOSD/src/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
{
newOsdRegion = CreateRectRgn(0, 0,
0, 0);
if (newOsdRegion == default) throw new Win32Exception(Marshal.GetLastWin32Error());
if (newOsdRegion == default) throw new Win32Exception();
}
else // Reset
{
Expand Down

0 comments on commit 8cc2e41

Please sign in to comment.