diff --git a/Eve-O-Preview/DwmAPI/DWM_BLURBEHIND.cs b/Eve-O-Preview/DwmAPI/DWM_BLURBEHIND.cs
new file mode 100644
index 0000000..14ebd8e
--- /dev/null
+++ b/Eve-O-Preview/DwmAPI/DWM_BLURBEHIND.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Runtime.InteropServices;
+
+namespace EveOPreview
+{
+ [StructLayout(LayoutKind.Sequential)]
+ class DWM_BLURBEHIND
+ {
+ public uint dwFlags;
+ [MarshalAs(UnmanagedType.Bool)]
+ public bool fEnable;
+ public IntPtr hRegionBlur;
+ [MarshalAs(UnmanagedType.Bool)]
+ public bool fTransitionOnMaximized;
+
+ public const uint DWM_BB_ENABLE = 0x00000001;
+ public const uint DWM_BB_BLURREGION = 0x00000002;
+ public const uint DWM_BB_TRANSITIONONMAXIMIZED = 0x00000004;
+ }
+}
\ No newline at end of file
diff --git a/Eve-O-Preview/DwmAPI/DWM_THUMBNAIL_PROPERTIES.cs b/Eve-O-Preview/DwmAPI/DWM_THUMBNAIL_PROPERTIES.cs
new file mode 100644
index 0000000..b5d270a
--- /dev/null
+++ b/Eve-O-Preview/DwmAPI/DWM_THUMBNAIL_PROPERTIES.cs
@@ -0,0 +1,23 @@
+using System.Runtime.InteropServices;
+
+namespace EveOPreview
+{
+ [StructLayout(LayoutKind.Sequential)]
+ internal class DWM_THUMBNAIL_PROPERTIES
+ {
+ public uint dwFlags;
+ public RECT rcDestination;
+ public RECT rcSource;
+ public byte opacity;
+ [MarshalAs(UnmanagedType.Bool)]
+ public bool fVisible;
+ [MarshalAs(UnmanagedType.Bool)]
+ public bool fSourceClientAreaOnly;
+
+ public const uint DWM_TNP_RECTDESTINATION = 0x00000001;
+ public const uint DWM_TNP_RECTSOURCE = 0x00000002;
+ public const uint DWM_TNP_OPACITY = 0x00000004;
+ public const uint DWM_TNP_VISIBLE = 0x00000008;
+ public const uint DWM_TNP_SOURCECLIENTAREAONLY = 0x00000010;
+ }
+}
\ No newline at end of file
diff --git a/Eve-O-Preview/Win32api.cs b/Eve-O-Preview/DwmAPI/DwmApiNativeMethods.cs
similarity index 70%
rename from Eve-O-Preview/Win32api.cs
rename to Eve-O-Preview/DwmAPI/DwmApiNativeMethods.cs
index 84a55a2..027f6ac 100644
--- a/Eve-O-Preview/Win32api.cs
+++ b/Eve-O-Preview/DwmAPI/DwmApiNativeMethods.cs
@@ -1,14 +1,12 @@
using System;
using System.Runtime.InteropServices;
using System.Drawing;
-using System.Text;
namespace EveOPreview
{
// Desktop Windows Manager APIs
- internal class DwmApi
+ static class DwmApiNativeMethods
{
-
[DllImport("user32.dll")]
public static extern IntPtr GetForegroundWindow();
@@ -43,65 +41,8 @@ namespace EveOPreview
[DllImport("dwmapi.dll", PreserveSig = false)]
public static extern void DwmQueryThumbnailSourceSize(IntPtr hThumbnail, out Size size);
-
- [StructLayout(LayoutKind.Sequential)]
- public class DWM_THUMBNAIL_PROPERTIES
- {
- public uint dwFlags;
- public RECT rcDestination;
- public RECT rcSource;
- public byte opacity;
- [MarshalAs(UnmanagedType.Bool)]
- public bool fVisible;
- [MarshalAs(UnmanagedType.Bool)]
- public bool fSourceClientAreaOnly;
- public const uint DWM_TNP_RECTDESTINATION = 0x00000001;
- public const uint DWM_TNP_RECTSOURCE = 0x00000002;
- public const uint DWM_TNP_OPACITY = 0x00000004;
- public const uint DWM_TNP_VISIBLE = 0x00000008;
- public const uint DWM_TNP_SOURCECLIENTAREAONLY = 0x00000010;
- }
-
- [StructLayout(LayoutKind.Sequential)]
- public class MARGINS
- {
- public int cxLeftWidth, cxRightWidth, cyTopHeight, cyBottomHeight;
-
- public MARGINS(int left, int top, int right, int bottom)
- {
- cxLeftWidth = left; cyTopHeight = top;
- cxRightWidth = right; cyBottomHeight = bottom;
- }
- }
-
- [StructLayout(LayoutKind.Sequential)]
- public class DWM_BLURBEHIND
- {
- public uint dwFlags;
- [MarshalAs(UnmanagedType.Bool)]
- public bool fEnable;
- public IntPtr hRegionBlur;
- [MarshalAs(UnmanagedType.Bool)]
- public bool fTransitionOnMaximized;
-
- public const uint DWM_BB_ENABLE = 0x00000001;
- public const uint DWM_BB_BLURREGION = 0x00000002;
- public const uint DWM_BB_TRANSITIONONMAXIMIZED = 0x00000004;
- }
-
- [StructLayout(LayoutKind.Sequential)]
- public struct RECT
- {
- public int left, top, right, bottom;
-
- public RECT(int left, int top, int right, int bottom)
- {
- this.left = left; this.top = top; this.right = right; this.bottom = bottom;
- }
- }
-
- public const int SW_SHOWNORMAL = 1;
+ public const int SW_SHOWNORMAL = 1;
public const int SW_SHOWMINIMIZED = 2;
public const int SW_SHOWMAXIMIZED = 3;
@@ -174,6 +115,5 @@ namespace EveOPreview
public const UInt32 WS_EX_LAYOUTRTL = 0x00400000; // Right to left mirroring
public const UInt32 WS_EX_COMPOSITED = 0x02000000;
public const UInt32 WS_EX_NOACTIVATE = 0x08000000;
-
}
}
\ No newline at end of file
diff --git a/Eve-O-Preview/DwmAPI/MARGINS.cs b/Eve-O-Preview/DwmAPI/MARGINS.cs
new file mode 100644
index 0000000..58ad6fc
--- /dev/null
+++ b/Eve-O-Preview/DwmAPI/MARGINS.cs
@@ -0,0 +1,21 @@
+using System.Runtime.InteropServices;
+
+namespace EveOPreview
+{
+ [StructLayout(LayoutKind.Sequential)]
+ class MARGINS
+ {
+ public int cxLeftWidth;
+ public int cxRightWidth;
+ public int cyTopHeight;
+ public int cyBottomHeight;
+
+ public MARGINS(int left, int top, int right, int bottom)
+ {
+ cxLeftWidth = left;
+ cyTopHeight = top;
+ cxRightWidth = right;
+ cyBottomHeight = bottom;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Eve-O-Preview/DwmAPI/RECT.cs b/Eve-O-Preview/DwmAPI/RECT.cs
new file mode 100644
index 0000000..68eee6a
--- /dev/null
+++ b/Eve-O-Preview/DwmAPI/RECT.cs
@@ -0,0 +1,21 @@
+using System.Runtime.InteropServices;
+
+namespace EveOPreview
+{
+ [StructLayout(LayoutKind.Sequential)]
+ struct RECT
+ {
+ public int left;
+ public int top;
+ public int right;
+ public int bottom;
+
+ public RECT(int left, int top, int right, int bottom)
+ {
+ this.left = left;
+ this.top = top;
+ this.right = right;
+ this.bottom = bottom;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Eve-O-Preview/Eve-O-Preview.csproj b/Eve-O-Preview/Eve-O-Preview.csproj
index 4cbd220..2f6ff94 100644
--- a/Eve-O-Preview/Eve-O-Preview.csproj
+++ b/Eve-O-Preview/Eve-O-Preview.csproj
@@ -96,6 +96,10 @@
+
+
+
+
@@ -153,7 +157,7 @@
Preview.cs
-
+
diff --git a/Eve-O-Preview/Preview.cs b/Eve-O-Preview/Preview.cs
index 693563d..91d0556 100644
--- a/Eve-O-Preview/Preview.cs
+++ b/Eve-O-Preview/Preview.cs
@@ -17,7 +17,7 @@ namespace EveOPreview
private IntPtr m_hThumbnail;
public IntPtr sourceWindow;
- private DwmApi.DWM_THUMBNAIL_PROPERTIES m_ThumbnailProperties;
+ private DWM_THUMBNAIL_PROPERTIES m_ThumbnailProperties;
private bool has_been_set_up = false;
private bool thumbnail_has_been_set_up = false;
private PreviewToyHandler spawner;
@@ -231,14 +231,14 @@ namespace EveOPreview
{
if (has_been_set_up)
{
- if (DwmApi.DwmIsCompositionEnabled())
+ if (DwmApiNativeMethods.DwmIsCompositionEnabled())
{
if (thumbnail_has_been_set_up == false)
{
this.SetUpThumbnail();
}
- m_ThumbnailProperties.rcDestination = new DwmApi.RECT(0, 0, ClientRectangle.Right, ClientRectangle.Bottom);
- DwmApi.DwmUpdateThumbnailProperties(m_hThumbnail, m_ThumbnailProperties);
+ m_ThumbnailProperties.rcDestination = new RECT(0, 0, ClientRectangle.Right, ClientRectangle.Bottom);
+ DwmApiNativeMethods.DwmUpdateThumbnailProperties(m_hThumbnail, m_ThumbnailProperties);
}
else
{
@@ -284,21 +284,21 @@ namespace EveOPreview
private void SetUpThumbnail()
{
- if (DwmApi.DwmIsCompositionEnabled() && !thumbnail_has_been_set_up)
+ if (DwmApiNativeMethods.DwmIsCompositionEnabled() && !thumbnail_has_been_set_up)
{
- m_hThumbnail = DwmApi.DwmRegisterThumbnail(this.Handle, sourceWindow);
+ m_hThumbnail = DwmApiNativeMethods.DwmRegisterThumbnail(this.Handle, sourceWindow);
- m_ThumbnailProperties = new DwmApi.DWM_THUMBNAIL_PROPERTIES();
- m_ThumbnailProperties.dwFlags = DwmApi.DWM_THUMBNAIL_PROPERTIES.DWM_TNP_VISIBLE
- + DwmApi.DWM_THUMBNAIL_PROPERTIES.DWM_TNP_OPACITY
- + DwmApi.DWM_THUMBNAIL_PROPERTIES.DWM_TNP_RECTDESTINATION
- + DwmApi.DWM_THUMBNAIL_PROPERTIES.DWM_TNP_SOURCECLIENTAREAONLY;
+ m_ThumbnailProperties = new DWM_THUMBNAIL_PROPERTIES();
+ m_ThumbnailProperties.dwFlags = DWM_THUMBNAIL_PROPERTIES.DWM_TNP_VISIBLE
+ + DWM_THUMBNAIL_PROPERTIES.DWM_TNP_OPACITY
+ + DWM_THUMBNAIL_PROPERTIES.DWM_TNP_RECTDESTINATION
+ + DWM_THUMBNAIL_PROPERTIES.DWM_TNP_SOURCECLIENTAREAONLY;
m_ThumbnailProperties.opacity = 255;
m_ThumbnailProperties.fVisible = true;
m_ThumbnailProperties.fSourceClientAreaOnly = true;
- m_ThumbnailProperties.rcDestination = new DwmApi.RECT(0, 0, ClientRectangle.Right, ClientRectangle.Bottom);
+ m_ThumbnailProperties.rcDestination = new RECT(0, 0, ClientRectangle.Right, ClientRectangle.Bottom);
- DwmApi.DwmUpdateThumbnailProperties(m_hThumbnail, m_ThumbnailProperties);
+ DwmApiNativeMethods.DwmUpdateThumbnailProperties(m_hThumbnail, m_ThumbnailProperties);
thumbnail_has_been_set_up = true;
}
@@ -311,15 +311,15 @@ namespace EveOPreview
public void bring_client_to_foreground()
{
- DwmApi.SetForegroundWindow(sourceWindow);
- int style = DwmApi.GetWindowLong(sourceWindow, DwmApi.GWL_STYLE);
- if ((style & DwmApi.WS_MAXIMIZE) == DwmApi.WS_MAXIMIZE)
+ DwmApiNativeMethods.SetForegroundWindow(sourceWindow);
+ int style = DwmApiNativeMethods.GetWindowLong(sourceWindow, DwmApiNativeMethods.GWL_STYLE);
+ if ((style & DwmApiNativeMethods.WS_MAXIMIZE) == DwmApiNativeMethods.WS_MAXIMIZE)
{
//It's maximized
}
- else if ((style & DwmApi.WS_MINIMIZE) == DwmApi.WS_MINIMIZE)
+ else if ((style & DwmApiNativeMethods.WS_MINIMIZE) == DwmApiNativeMethods.WS_MINIMIZE)
{
- DwmApi.ShowWindowAsync(sourceWindow, DwmApi.SW_SHOWNORMAL);
+ DwmApiNativeMethods.ShowWindowAsync(sourceWindow, DwmApiNativeMethods.SW_SHOWNORMAL);
}
}
diff --git a/Eve-O-Preview/PreviewHandler.cs b/Eve-O-Preview/PreviewHandler.cs
index 6d7c6d6..ce325e0 100644
--- a/Eve-O-Preview/PreviewHandler.cs
+++ b/Eve-O-Preview/PreviewHandler.cs
@@ -224,7 +224,7 @@ namespace EveOPreview
refresh_client_window_locations(process);
}
- if (process.MainWindowHandle == DwmApi.GetForegroundWindow())
+ if (process.MainWindowHandle == DwmApiNativeMethods.GetForegroundWindow())
{
active_client_handle = process.MainWindowHandle;
active_client_title = process.MainWindowTitle;
@@ -512,7 +512,7 @@ namespace EveOPreview
private void refresh_thumbnails()
{
- IntPtr active_window = DwmApi.GetForegroundWindow();
+ IntPtr active_window = DwmApiNativeMethods.GetForegroundWindow();
// hide, show, resize and move
foreach (KeyValuePair entry in previews)
@@ -547,7 +547,7 @@ namespace EveOPreview
}
}
- DwmApi.DwmIsCompositionEnabled();
+ DwmApiNativeMethods.DwmIsCompositionEnabled();
}
@@ -566,7 +566,7 @@ namespace EveOPreview
foreach (KeyValuePair entry in previews)
{
- if (entry.Value.Handle != DwmApi.GetForegroundWindow())
+ if (entry.Value.Handle != DwmApiNativeMethods.GetForegroundWindow())
{
entry.Value.set_render_area_size(sync_size);
}
@@ -607,7 +607,7 @@ namespace EveOPreview
refresh_thumbnails();
if (ignoring_size_sync.ElapsedMilliseconds > 500) { ignoring_size_sync.Stop(); };
- if (DwmApi.DwmIsCompositionEnabled())
+ if (DwmApiNativeMethods.DwmIsCompositionEnabled())
{
aero_status_label.Text = "AERO is ON";
aero_status_label.ForeColor = Color.Black;