From 7f105ba52029469d1fbd707ae0367cef20882e66 Mon Sep 17 00:00:00 2001 From: Nicke Manarin Date: Tue, 29 Nov 2016 19:05:39 -0200 Subject: [PATCH] Release 2.3.2 See release notes. --- Other/GifDecoder/App.config | 6 - Other/GifDecoder/App.xaml | 8 - Other/GifDecoder/App.xaml.cs | 17 - Other/GifDecoder/GifDecoder.csproj | 105 --- Other/GifDecoder/MainWindow.xaml | 8 - Other/GifDecoder/MainWindow.xaml.cs | 28 - Other/GifDecoder/Properties/AssemblyInfo.cs | 55 -- .../Properties/Resources.Designer.cs | 71 -- Other/GifDecoder/Properties/Resources.resx | 117 ---- .../Properties/Settings.Designer.cs | 30 - Other/GifDecoder/Properties/Settings.settings | 7 - ...le_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs | 0 Other/HookTest/Util/UserActivityHook.cs | 2 + RecordingTest/App.config | 6 - RecordingTest/App.xaml | 9 - RecordingTest/App.xaml.cs | 17 - RecordingTest/MainWindow.xaml | 26 - RecordingTest/MainWindow.xaml.cs | 52 -- RecordingTest/Native.cs | 628 ------------------ RecordingTest/Properties/AssemblyInfo.cs | 55 -- .../Properties/Resources.Designer.cs | 71 -- RecordingTest/Properties/Resources.resx | 117 ---- RecordingTest/Properties/Settings.Designer.cs | 30 - RecordingTest/Properties/Settings.settings | 7 - RecordingTest/RecordingTest.csproj | 108 --- ScreenToGif/App.xaml | 15 +- ScreenToGif/Controls/PathListViewItem.cs | 121 +++- ScreenToGif/Controls/RadialPanel.cs | 57 ++ ScreenToGif/Controls/WebcamControl.xaml.cs | 24 +- ScreenToGif/FileWriters/LogWriter.cs | 149 +++-- ScreenToGif/Properties/AssemblyInfo.cs | 4 +- ScreenToGif/Readme.md | 19 +- .../Localization/StringResources.en.xaml | 19 +- .../Localization/StringResources.pt-BR.xaml | 22 +- .../Localization/StringResources.pt-PT.xaml | 2 - ScreenToGif/Resources/Settings.xaml | 1 - ScreenToGif/ScreenToGif.csproj | 1 + ScreenToGif/Themes/Generic.xaml | 66 ++ ScreenToGif/Util/ActionStack.cs | 14 +- ScreenToGif/Util/Enums.cs | 10 + ScreenToGif/Util/LocalizationHelper.cs | 12 +- ScreenToGif/Util/Native.cs | 6 +- ScreenToGif/Util/UserSettings.cs | 6 - .../Webcam/DirectShow/EditStreaming.cs | 22 +- ScreenToGif/Webcam/DirectX/CaptureWebcam.cs | 78 +-- ScreenToGif/Windows/Editor.xaml | 5 +- ScreenToGif/Windows/Editor.xaml.cs | 89 +-- ScreenToGif/Windows/Options.xaml | 6 +- ScreenToGif/Windows/Options.xaml.cs | 2 +- ScreenToGif/Windows/Other/DownloadDialog.xaml | 6 +- .../Windows/Other/Localization.xaml.cs | 99 +-- .../Windows/Other/SelectFolderDialog.xaml | 10 +- .../Windows/Other/SelectFolderDialog.xaml.cs | 13 +- ScreenToGif/Windows/Other/Startup.xaml | 2 +- ScreenToGif/Windows/Other/Startup.xaml.cs | 8 +- ScreenToGif/Windows/Other/TestField.xaml | 41 +- ScreenToGif/Windows/Recorder.xaml | 2 +- ScreenToGif/Windows/Webcam.xaml | 25 +- ScreenToGif/Windows/Webcam.xaml.cs | 42 +- 59 files changed, 645 insertions(+), 1933 deletions(-) delete mode 100644 Other/GifDecoder/App.config delete mode 100644 Other/GifDecoder/App.xaml delete mode 100644 Other/GifDecoder/App.xaml.cs delete mode 100644 Other/GifDecoder/GifDecoder.csproj delete mode 100644 Other/GifDecoder/MainWindow.xaml delete mode 100644 Other/GifDecoder/MainWindow.xaml.cs delete mode 100644 Other/GifDecoder/Properties/AssemblyInfo.cs delete mode 100644 Other/GifDecoder/Properties/Resources.Designer.cs delete mode 100644 Other/GifDecoder/Properties/Resources.resx delete mode 100644 Other/GifDecoder/Properties/Settings.Designer.cs delete mode 100644 Other/GifDecoder/Properties/Settings.settings delete mode 100644 Other/GifDecoder/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs delete mode 100644 RecordingTest/App.config delete mode 100644 RecordingTest/App.xaml delete mode 100644 RecordingTest/App.xaml.cs delete mode 100644 RecordingTest/MainWindow.xaml delete mode 100644 RecordingTest/MainWindow.xaml.cs delete mode 100644 RecordingTest/Native.cs delete mode 100644 RecordingTest/Properties/AssemblyInfo.cs delete mode 100644 RecordingTest/Properties/Resources.Designer.cs delete mode 100644 RecordingTest/Properties/Resources.resx delete mode 100644 RecordingTest/Properties/Settings.Designer.cs delete mode 100644 RecordingTest/Properties/Settings.settings delete mode 100644 RecordingTest/RecordingTest.csproj create mode 100644 ScreenToGif/Controls/RadialPanel.cs diff --git a/Other/GifDecoder/App.config b/Other/GifDecoder/App.config deleted file mode 100644 index 9c05822f..00000000 --- a/Other/GifDecoder/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Other/GifDecoder/App.xaml b/Other/GifDecoder/App.xaml deleted file mode 100644 index 1350e438..00000000 --- a/Other/GifDecoder/App.xaml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - diff --git a/Other/GifDecoder/App.xaml.cs b/Other/GifDecoder/App.xaml.cs deleted file mode 100644 index c4ae40ea..00000000 --- a/Other/GifDecoder/App.xaml.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Configuration; -using System.Data; -using System.Linq; -using System.Threading.Tasks; -using System.Windows; - -namespace GifDecoder -{ - /// - /// Interaction logic for App.xaml - /// - public partial class App : Application - { - } -} diff --git a/Other/GifDecoder/GifDecoder.csproj b/Other/GifDecoder/GifDecoder.csproj deleted file mode 100644 index 458c4af7..00000000 --- a/Other/GifDecoder/GifDecoder.csproj +++ /dev/null @@ -1,105 +0,0 @@ - - - - - Debug - AnyCPU - {67E24AD3-97C4-48AE-A7BB-955C0A35CAF3} - WinExe - Properties - GifDecoder - GifDecoder - v4.5.1 - 512 - {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 4 - true - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - 4.0 - - - - - - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - App.xaml - Code - - - MainWindow.xaml - Code - - - - - Code - - - True - True - Resources.resx - - - True - Settings.settings - True - - - ResXFileCodeGenerator - Resources.Designer.cs - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - - - - - - - \ No newline at end of file diff --git a/Other/GifDecoder/MainWindow.xaml b/Other/GifDecoder/MainWindow.xaml deleted file mode 100644 index bf269b26..00000000 --- a/Other/GifDecoder/MainWindow.xaml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - diff --git a/Other/GifDecoder/MainWindow.xaml.cs b/Other/GifDecoder/MainWindow.xaml.cs deleted file mode 100644 index 8db130cb..00000000 --- a/Other/GifDecoder/MainWindow.xaml.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace GifDecoder -{ - /// - /// Interaction logic for MainWindow.xaml - /// - public partial class MainWindow : Window - { - public MainWindow() - { - InitializeComponent(); - } - } -} diff --git a/Other/GifDecoder/Properties/AssemblyInfo.cs b/Other/GifDecoder/Properties/AssemblyInfo.cs deleted file mode 100644 index a1f6a664..00000000 --- a/Other/GifDecoder/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System.Reflection; -using System.Resources; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Windows; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("GifDecoder")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("GifDecoder")] -[assembly: AssemblyCopyright("Copyright © 2015")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -//In order to begin building localizable applications, set -//CultureYouAreCodingWith in your .csproj file -//inside a . For example, if you are using US english -//in your source files, set the to en-US. Then uncomment -//the NeutralResourceLanguage attribute below. Update the "en-US" in -//the line below to match the UICulture setting in the project file. - -//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] - - -[assembly: ThemeInfo( - ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located - //(used if a resource is not found in the page, - // or application resource dictionaries) - ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located - //(used if a resource is not found in the page, - // app, or any theme specific resource dictionaries) -)] - - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Other/GifDecoder/Properties/Resources.Designer.cs b/Other/GifDecoder/Properties/Resources.Designer.cs deleted file mode 100644 index a63c9602..00000000 --- a/Other/GifDecoder/Properties/Resources.Designer.cs +++ /dev/null @@ -1,71 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.34014 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace GifDecoder.Properties -{ - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources - { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() - { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager - { - get - { - if ((resourceMan == null)) - { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("GifDecoder.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture - { - get - { - return resourceCulture; - } - set - { - resourceCulture = value; - } - } - } -} diff --git a/Other/GifDecoder/Properties/Resources.resx b/Other/GifDecoder/Properties/Resources.resx deleted file mode 100644 index af7dbebb..00000000 --- a/Other/GifDecoder/Properties/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Other/GifDecoder/Properties/Settings.Designer.cs b/Other/GifDecoder/Properties/Settings.Designer.cs deleted file mode 100644 index f28a1ad0..00000000 --- a/Other/GifDecoder/Properties/Settings.Designer.cs +++ /dev/null @@ -1,30 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.34014 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace GifDecoder.Properties -{ - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default - { - get - { - return defaultInstance; - } - } - } -} diff --git a/Other/GifDecoder/Properties/Settings.settings b/Other/GifDecoder/Properties/Settings.settings deleted file mode 100644 index 033d7a5e..00000000 --- a/Other/GifDecoder/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/Other/GifDecoder/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs b/Other/GifDecoder/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs deleted file mode 100644 index e69de29b..00000000 diff --git a/Other/HookTest/Util/UserActivityHook.cs b/Other/HookTest/Util/UserActivityHook.cs index b5465385..5a7356d1 100644 --- a/Other/HookTest/Util/UserActivityHook.cs +++ b/Other/HookTest/Util/UserActivityHook.cs @@ -437,6 +437,8 @@ private class KeyboardHookStruct /// Any windows problem. public UserActivityHook() { + new System.Security.Permissions.UIPermission(System.Security.Permissions.UIPermissionWindow.AllWindows).Demand(); + Start(); } diff --git a/RecordingTest/App.config b/RecordingTest/App.config deleted file mode 100644 index 8e156463..00000000 --- a/RecordingTest/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/RecordingTest/App.xaml b/RecordingTest/App.xaml deleted file mode 100644 index 900bc75f..00000000 --- a/RecordingTest/App.xaml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - diff --git a/RecordingTest/App.xaml.cs b/RecordingTest/App.xaml.cs deleted file mode 100644 index c89babfe..00000000 --- a/RecordingTest/App.xaml.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Configuration; -using System.Data; -using System.Linq; -using System.Threading.Tasks; -using System.Windows; - -namespace RecordingTest -{ - /// - /// Interaction logic for App.xaml - /// - public partial class App : Application - { - } -} diff --git a/RecordingTest/MainWindow.xaml b/RecordingTest/MainWindow.xaml deleted file mode 100644 index d237922e..00000000 --- a/RecordingTest/MainWindow.xaml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/RecordingTest/MainWindow.xaml.cs b/RecordingTest/MainWindow.xaml.cs deleted file mode 100644 index 7e8246e7..00000000 --- a/RecordingTest/MainWindow.xaml.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Forms; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace RecordingTest -{ - /// - /// Interaction logic for MainWindow.xaml - /// - public partial class MainWindow : Window - { - public MainWindow() - { - InitializeComponent(); - } - - private void Photo_Click(object sender, RoutedEventArgs e) - { - var fbd = new FolderBrowserDialog(); - var result = fbd.ShowDialog(); - - if (result != System.Windows.Forms.DialogResult.OK) - return; - - //Exactly like version 1.4.2 - var bt = new Bitmap((int)Width, (int)Height); - var gr = Graphics.FromImage(bt); - gr.CopyFromScreen((int)Left, (int)Top ,0,0, new System.Drawing.Size((int)Width, (int)Height)); - - bt.Save(System.IO.Path.Combine(fbd.SelectedPath, "Image 1.png")); - - - var bt2 = Native.Capture(new System.Windows.Size((int) Width, (int) Height), (int)Left, (int)Top); - bt2.Save(System.IO.Path.Combine(fbd.SelectedPath, "Image 2.png")); - - //Exactly like version 2.1 - } - } -} diff --git a/RecordingTest/Native.cs b/RecordingTest/Native.cs deleted file mode 100644 index 16a636d4..00000000 --- a/RecordingTest/Native.cs +++ /dev/null @@ -1,628 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using System.Windows; -using System.Windows.Interop; -using System.Windows.Media.Imaging; - -namespace RecordingTest -{ - public static class Native - { - #region Variables/Const - - internal const int MonitorDefaultToNull = 0; - internal const int MonitorDefaultToPrimary = 1; - internal const int MonitorDefaultToNearest = 2; - - internal const int CursorShowing = 0x00000001; - internal const int DstInvert = 0x00550009; - - [StructLayout(LayoutKind.Sequential)] - internal struct ICONINFO - { - public bool fIcon; // Specifies whether this structure defines an icon or a cursor. A value of TRUE specifies - public int xHotspot; // Specifies the x-coordinate of a cursor's hot spot. If this structure defines an icon, the hot - public int yHotspot; // Specifies the y-coordinate of the cursor's hot spot. If this structure defines an icon, the hot - public IntPtr hbmMask; // (HBITMAP) Specifies the icon bitmask bitmap. If this structure defines a black and white icon, - public IntPtr hbmColor; // (HBITMAP) Handle to the icon color bitmap. This member can be optional if this - } - - [StructLayout(LayoutKind.Sequential)] - internal struct POINT - { - public int X; - public int Y; - } - - [StructLayout(LayoutKind.Sequential)] - internal struct CursorInfo - { - /// - /// Specifies the size, in bytes, of the structure. - /// - public int cbSize; - - /// - /// Specifies the cursor state. This parameter can be one of the following values: - /// - public int flags; - - /// - ///Handle to the cursor. - /// - public IntPtr hCursor; - - /// - /// A POINT structure that receives the screen coordinates of the cursor. - /// - public POINT ptScreenPos; - } - - /// - ///Specifies a raster-operation code. These codes define how the color data for the - ///source rectangle is to be combined with the color data for the destination - ///rectangle to achieve the final color. - /// - internal enum CopyPixelOperation - { - NoMirrorBitmap = -2147483648, - - /// dest = BLACK, 0x00000042 - Blackness = 66, - - ///dest = (NOT src) AND (NOT dest), 0x001100A6 - NotSourceErase = 1114278, - - ///dest = (NOT source), 0x00330008 - NotSourceCopy = 3342344, - - ///dest = source AND (NOT dest), 0x00440328 - SourceErase = 4457256, - - /// dest = (NOT dest), 0x00550009 - DestinationInvert = 5570569, - - /// dest = pattern XOR dest, 0x005A0049 - PatInvert = 5898313, - - ///dest = source XOR dest, 0x00660046 - SourceInvert = 6684742, - - ///dest = source AND dest, 0x008800C6 - SourceAnd = 8913094, - - /// dest = (NOT source) OR dest, 0x00BB0226 - MergePaint = 12255782, - - ///dest = (source AND pattern), 0x00C000CA - MergeCopy = 12583114, - - ///dest = source, 0x00CC0020 - SourceCopy = 13369376, - - /// dest = source OR dest, 0x00EE0086 - SourcePaint = 15597702, - - /// dest = pattern, 0x00F00021 - PatCopy = 15728673, - - /// dest = DPSnoo, 0x00FB0A09 - PatPaint = 16452105, - - /// dest = WHITE, 0x00FF0062 - Whiteness = 16711778, - - /// - /// Capture window as seen on screen. This includes layered windows - /// such as WPF windows with AllowsTransparency="true", 0x40000000 - /// - CaptureBlt = 1073741824, - } - - internal enum DeviceCaps : int - { - LogPixelsX = 88, - LogPixelsY = 90, - } - - [StructLayout(LayoutKind.Sequential)] - internal struct Rect - { - public int Left; // x position of upper-left corner - public int Top; // y position of upper-left corner - public int Right; // x position of lower-right corner - public int Bottom; // y position of lower-right corner - - public Int32Rect ToRectangle() - { - return new Int32Rect(Left, Top, Right - Left, Bottom - Top); - } - } - - internal struct Margins - { - public Margins(Thickness t) - { - Left = (int)t.Left; - Right = (int)t.Right; - Top = (int)t.Top; - Bottom = (int)t.Bottom; - } - - public int Left; - public int Right; - public int Top; - public int Bottom; - } - - internal enum PROCESS_DPI_AWARENESS - { - Process_DPI_Unaware = 0, - Process_System_DPI_Aware = 1, - Process_Per_Monitor_DPI_Aware = 2 - } - - internal enum DwmWindowAttribute - { - DwmwaNcrenderingEnabled = 1, - DwmwaNcrenderingPolicy, - DwmwaTransitionsForcedisabled, - DwmwaAllowNcpaint, - DwmwaCaptionButtonBounds, - DwmwaNonclientRtlLayout, - DwmwaForceIconicRepresentation, - DwmwaFlip3DPolicy, - DwmwaExtendedFrameBounds, - DwmwaHasIconicBitmap, - DwmwaDisallowPeek, - DwmwaExcludedFromPeek, - DwmwaCloak, - DwmwaCloaked, - DwmwaFreezeRepresentation, - DwmwaLast - } - - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto, Pack = 4)] - internal class MonitorInfoEx - { - public int cbSize = Marshal.SizeOf(typeof(MonitorInfoEx)); - public Rect rcMonitor = new Rect(); - public Rect rcWork = new Rect(); - public int dwFlags = 0; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public char[] szDevice = new char[32]; - } - - [Flags] - private enum KnownFolderFlags : uint - { - SimpleIDList = 0x00000100, - NotParentRelative = 0x00000200, - DefaultPath = 0x00000400, - Init = 0x00000800, - NoAlias = 0x00001000, - DontUnexpand = 0x00002000, - DontVerify = 0x00004000, - Create = 0x00008000, - NoAppcontainerRedirection = 0x00010000, - AliasOnly = 0x80000000 - } - - internal static class KnownFolder - { - internal static readonly Guid AddNewPrograms = new Guid("de61d971-5ebc-4f02-a3a9-6c82895e5c04"); - internal static readonly Guid AdminTools = new Guid("724EF170-A42D-4FEF-9F26-B60E846FBA4F"); - internal static readonly Guid AppUpdates = new Guid("a305ce99-f527-492b-8b1a-7e76fa98d6e4"); - internal static readonly Guid CDBurning = new Guid("9E52AB10-F80D-49DF-ACB8-4330F5687855"); - internal static readonly Guid ChangeRemovePrograms = new Guid("df7266ac-9274-4867-8d55-3bd661de872d"); - internal static readonly Guid CommonAdminTools = new Guid("D0384E7D-BAC3-4797-8F14-CBA229B392B5"); - internal static readonly Guid CommonOEMLinks = new Guid("C1BAE2D0-10DF-4334-BEDD-7AA20B227A9D"); - internal static readonly Guid CommonPrograms = new Guid("0139D44E-6AFE-49F2-8690-3DAFCAE6FFB8"); - internal static readonly Guid CommonStartMenu = new Guid("A4115719-D62E-491D-AA7C-E74B8BE3B067"); - internal static readonly Guid CommonStartup = new Guid("82A5EA35-D9CD-47C5-9629-E15D2F714E6E"); - internal static readonly Guid CommonTemplates = new Guid("B94237E7-57AC-4347-9151-B08C6C32D1F7"); - internal static readonly Guid ComputerFolder = new Guid("0AC0837C-BBF8-452A-850D-79D08E667CA7"); - internal static readonly Guid ConflictFolder = new Guid("4bfefb45-347d-4006-a5be-ac0cb0567192"); - internal static readonly Guid ConnectionsFolder = new Guid("6F0CD92B-2E97-45D1-88FF-B0D186B8DEDD"); - internal static readonly Guid Contacts = new Guid("56784854-C6CB-462b-8169-88E350ACB882"); - internal static readonly Guid ControlPanelFolder = new Guid("82A74AEB-AEB4-465C-A014-D097EE346D63"); - internal static readonly Guid Cookies = new Guid("2B0F765D-C0E9-4171-908E-08A611B84FF6"); - internal static readonly Guid Desktop = new Guid("B4BFCC3A-DB2C-424C-B029-7FE99A87C641"); - internal static readonly Guid Documents = new Guid("FDD39AD0-238F-46AF-ADB4-6C85480369C7"); - internal static readonly Guid Downloads = new Guid("374DE290-123F-4565-9164-39C4925E467B"); - internal static readonly Guid Favorites = new Guid("1777F761-68AD-4D8A-87BD-30B759FA33DD"); - internal static readonly Guid Fonts = new Guid("FD228CB7-AE11-4AE3-864C-16F3910AB8FE"); - internal static readonly Guid Games = new Guid("CAC52C1A-B53D-4edc-92D7-6B2E8AC19434"); - internal static readonly Guid GameTasks = new Guid("054FAE61-4DD8-4787-80B6-090220C4B700"); - internal static readonly Guid History = new Guid("D9DC8A3B-B784-432E-A781-5A1130A75963"); - internal static readonly Guid InternetCache = new Guid("352481E8-33BE-4251-BA85-6007CAEDCF9D"); - internal static readonly Guid InternetFolder = new Guid("4D9F7874-4E0C-4904-967B-40B0D20C3E4B"); - internal static readonly Guid Links = new Guid("bfb9d5e0-c6a9-404c-b2b2-ae6db6af4968"); - internal static readonly Guid LocalAppData = new Guid("F1B32785-6FBA-4FCF-9D55-7B8E7F157091"); - internal static readonly Guid LocalAppDataLow = new Guid("A520A1A4-1780-4FF6-BD18-167343C5AF16"); - internal static readonly Guid LocalizedResourcesDir = new Guid("2A00375E-224C-49DE-B8D1-440DF7EF3DDC"); - internal static readonly Guid Music = new Guid("4BD8D571-6D19-48D3-BE97-422220080E43"); - internal static readonly Guid NetHood = new Guid("C5ABBF53-E17F-4121-8900-86626FC2C973"); - internal static readonly Guid NetworkFolder = new Guid("D20BEEC4-5CA8-4905-AE3B-BF251EA09B53"); - internal static readonly Guid OriginalImages = new Guid("2C36C0AA-5812-4b87-BFD0-4CD0DFB19B39"); - internal static readonly Guid PhotoAlbums = new Guid("69D2CF90-FC33-4FB7-9A0C-EBB0F0FCB43C"); - internal static readonly Guid Pictures = new Guid("33E28130-4E1E-4676-835A-98395C3BC3BB"); - internal static readonly Guid Playlists = new Guid("DE92C1C7-837F-4F69-A3BB-86E631204A23"); - internal static readonly Guid PrintersFolder = new Guid("76FC4E2D-D6AD-4519-A663-37BD56068185"); - internal static readonly Guid PrintHood = new Guid("9274BD8D-CFD1-41C3-B35E-B13F55A758F4"); - internal static readonly Guid Profile = new Guid("5E6C858F-0E22-4760-9AFE-EA3317B67173"); - internal static readonly Guid ProgramData = new Guid("62AB5D82-FDC1-4DC3-A9DD-070D1D495D97"); - internal static readonly Guid ProgramFiles = new Guid("905e63b6-c1bf-494e-b29c-65b732d3d21a"); - internal static readonly Guid ProgramFilesX64 = new Guid("6D809377-6AF0-444b-8957-A3773F02200E"); - internal static readonly Guid ProgramFilesX86 = new Guid("7C5A40EF-A0FB-4BFC-874A-C0F2E0B9FA8E"); - internal static readonly Guid ProgramFilesCommon = new Guid("F7F1ED05-9F6D-47A2-AAAE-29D317C6F066"); - internal static readonly Guid ProgramFilesCommonX64 = new Guid("6365D5A7-0F0D-45E5-87F6-0DA56B6A4F7D"); - internal static readonly Guid ProgramFilesCommonX86 = new Guid("DE974D24-D9C6-4D3E-BF91-F4455120B917"); - internal static readonly Guid Programs = new Guid("A77F5D77-2E2B-44C3-A6A2-ABA601054A51"); - internal static readonly Guid Public = new Guid("DFDF76A2-C82A-4D63-906A-5644AC457385"); - internal static readonly Guid PublicDesktop = new Guid("C4AA340D-F20F-4863-AFEF-F87EF2E6BA25"); - internal static readonly Guid PublicDocuments = new Guid("ED4824AF-DCE4-45A8-81E2-FC7965083634"); - internal static readonly Guid PublicDownloads = new Guid("3D644C9B-1FB8-4f30-9B45-F670235F79C0"); - internal static readonly Guid PublicGameTasks = new Guid("DEBF2536-E1A8-4c59-B6A2-414586476AEA"); - internal static readonly Guid PublicMusic = new Guid("3214FAB5-9757-4298-BB61-92A9DEAA44FF"); - internal static readonly Guid PublicPictures = new Guid("B6EBFB86-6907-413C-9AF7-4FC2ABF07CC5"); - internal static readonly Guid PublicVideos = new Guid("2400183A-6185-49FB-A2D8-4A392A602BA3"); - internal static readonly Guid QuickLaunch = new Guid("52a4f021-7b75-48a9-9f6b-4b87a210bc8f"); - internal static readonly Guid Recent = new Guid("AE50C081-EBD2-438A-8655-8A092E34987A"); - internal static readonly Guid RecycleBinFolder = new Guid("B7534046-3ECB-4C18-BE4E-64CD4CB7D6AC"); - internal static readonly Guid ResourceDir = new Guid("8AD10C31-2ADB-4296-A8F7-E4701232C972"); - internal static readonly Guid RoamingAppData = new Guid("3EB685DB-65F9-4CF6-A03A-E3EF65729F3D"); - internal static readonly Guid SampleMusic = new Guid("B250C668-F57D-4EE1-A63C-290EE7D1AA1F"); - internal static readonly Guid SamplePictures = new Guid("C4900540-2379-4C75-844B-64E6FAF8716B"); - internal static readonly Guid SamplePlaylists = new Guid("15CA69B3-30EE-49C1-ACE1-6B5EC372AFB5"); - internal static readonly Guid SampleVideos = new Guid("859EAD94-2E85-48AD-A71A-0969CB56A6CD"); - internal static readonly Guid SavedGames = new Guid("4C5C32FF-BB9D-43b0-B5B4-2D72E54EAAA4"); - internal static readonly Guid SavedSearches = new Guid("7d1d3a04-debb-4115-95cf-2f29da2920da"); - internal static readonly Guid SEARCH_CSC = new Guid("ee32e446-31ca-4aba-814f-a5ebd2fd6d5e"); - internal static readonly Guid SEARCH_MAPI = new Guid("98ec0e18-2098-4d44-8644-66979315a281"); - internal static readonly Guid SearchHome = new Guid("190337d1-b8ca-4121-a639-6d472d16972a"); - internal static readonly Guid SendTo = new Guid("8983036C-27C0-404B-8F08-102D10DCFD74"); - internal static readonly Guid SidebarDefaultParts = new Guid("7B396E54-9EC5-4300-BE0A-2482EBAE1A26"); - internal static readonly Guid SidebarParts = new Guid("A75D362E-50FC-4fb7-AC2C-A8BEAA314493"); - internal static readonly Guid StartMenu = new Guid("625B53C3-AB48-4EC1-BA1F-A1EF4146FC19"); - internal static readonly Guid Startup = new Guid("B97D20BB-F46A-4C97-BA10-5E3608430854"); - internal static readonly Guid SyncManagerFolder = new Guid("43668BF8-C14E-49B2-97C9-747784D784B7"); - internal static readonly Guid SyncResultsFolder = new Guid("289a9a43-be44-4057-a41b-587a76d7e7f9"); - internal static readonly Guid SyncSetupFolder = new Guid("0F214138-B1D3-4a90-BBA9-27CBC0C5389A"); - internal static readonly Guid System = new Guid("1AC14E77-02E7-4E5D-B744-2EB1AE5198B7"); - internal static readonly Guid SystemX86 = new Guid("D65231B0-B2F1-4857-A4CE-A8E7C6EA7D27"); - internal static readonly Guid Templates = new Guid("A63293E8-664E-48DB-A079-DF759E0509F7"); - internal static readonly Guid TreeProperties = new Guid("5b3749ad-b49f-49c1-83eb-15370fbd4882"); - internal static readonly Guid UserProfiles = new Guid("0762D272-C50A-4BB0-A382-697DCD729B80"); - internal static readonly Guid UsersFiles = new Guid("f3ce0f7c-4901-4acc-8648-d5d44b04ef8f"); - internal static readonly Guid Videos = new Guid("18989B1D-99B5-455B-841C-AB7C74E4DDFC"); - internal static readonly Guid Windows = new Guid("F38BF404-1D43-42F2-9305-67DE0B28FC23"); - } - - #endregion - - #region Functions - - [DllImport("user32.dll")] - internal static extern bool ClientToScreen(IntPtr hWnd, ref POINT lpPoint); - - [DllImport("user32.dll", EntryPoint = "GetCursorInfo")] - internal static extern bool GetCursorInfo(out CursorInfo pci); - - [DllImport("user32.dll", EntryPoint = "CopyIcon")] - internal static extern IntPtr CopyIcon(IntPtr hIcon); - - [DllImport("user32.dll", EntryPoint = "GetIconInfo")] - internal static extern bool GetIconInfo(IntPtr hIcon, out ICONINFO piconinfo); - - /// - ///Creates a memory device context (DC) compatible with the specified device. - /// - ///A handle to an existing DC. If this handle is NULL, - ///the function creates a memory DC compatible with the application's current screen. - /// - ///If the function succeeds, the return value is the handle to a memory DC. - ///If the function fails, the return value is . - /// - [DllImport("gdi32.dll", EntryPoint = "CreateCompatibleDC", SetLastError = true)] - internal static extern IntPtr CreateCompatibleDC([In] IntPtr hdc); - - ///Selects an object into the specified device context (DC). The new object replaces the previous object of the same type. - ///A handle to the DC. - ///A handle to the object to be selected. - /// - ///If the selected object is not a region and the function succeeds, the return value is a handle to the object being replaced. If the selected object is a region and the function succeeds, the return value is one of the following values. - ///SIMPLEREGION - Region consists of a single rectangle. - ///COMPLEXREGION - Region consists of more than one rectangle. - ///NULLREGION - Region is empty. - ///If an error occurs and the selected object is not a region, the return value is NULL. Otherwise, it is HGDI_ERROR. - /// - /// - ///This function returns the previously selected object of the specified type. An application should always replace a new object with the original, default object after it has finished drawing with the new object. - ///An application cannot select a single bitmap into more than one DC at a time. - ///ICM: If the object being selected is a brush or a pen, color management is performed. - /// - [DllImport("gdi32.dll", EntryPoint = "SelectObject")] - internal static extern IntPtr SelectObject([In] IntPtr hdc, [In] IntPtr hgdiobj); - - /// - ///Performs a bit-block transfer of the color data corresponding to a - ///rectangle of pixels from the specified source device context into - ///a destination device context. - /// - ///Handle to the destination device context. - ///The leftmost x-coordinate of the destination rectangle (in pixels). - ///The topmost y-coordinate of the destination rectangle (in pixels). - ///The width of the source and destination rectangles (in pixels). - ///The height of the source and the destination rectangles (in pixels). - ///Handle to the source device context. - ///The leftmost x-coordinate of the source rectangle (in pixels). - ///The topmost y-coordinate of the source rectangle (in pixels). - ///A raster-operation code. - /// - ///true if the operation succeedes, false otherwise. To get extended error information, call . - /// - [DllImport("gdi32.dll", EntryPoint = "BitBlt", SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - internal static extern bool BitBlt([In] IntPtr hdc, int nXDest, int nYDest, int nWidth, int nHeight, [In] IntPtr hdcSrc, int nXSrc, int nYSrc, CopyPixelOperation dwRop); - //TernaryRasterOperations - - ///Deletes the specified device context (DC). - ///A handle to the device context. - ///If the function succeeds, the return value is nonzero.If the function fails, the return value is zero. - ///An application must not delete a DC whose handle was obtained by calling the GetDC function. Instead, it must call the ReleaseDC function to free the DC. - [DllImport("gdi32.dll", EntryPoint = "DeleteDC")] - internal static extern bool DeleteDC([In] IntPtr hdc); - - ///Deletes a logical pen, brush, font, bitmap, region, or palette, freeing all system resources associated with the object. After the object is deleted, the specified handle is no longer valid. - ///A handle to a logical pen, brush, font, bitmap, region, or palette. - /// - ///If the function succeeds, the return value is nonzero. - ///If the specified handle is not valid or is currently selected into a DC, the return value is zero. - /// - /// - ///Do not delete a drawing object (pen or brush) while it is still selected into a DC. - ///When a pattern brush is deleted, the bitmap associated with the brush is not deleted. The bitmap must be deleted independently. - /// - [DllImport("gdi32.dll", EntryPoint = "DeleteObject")] - [return: MarshalAs(UnmanagedType.Bool)] - internal static extern bool DeleteObject([In] IntPtr hObject); - - [DllImport("user32.dll", SetLastError = false)] - internal static extern IntPtr GetDesktopWindow(); - - [DllImport("user32.dll")] - internal static extern IntPtr GetWindowDC(IntPtr ptr); - - [DllImport("gdi32.dll")] - internal static extern IntPtr CreateCompatibleBitmap(IntPtr hdc, int nWidth, int nHeight); - - [DllImport("user32.dll")] - internal static extern bool ReleaseDC(IntPtr hWnd, IntPtr hDc); - - [DllImport("gdi32.dll")] - internal static extern int GetDeviceCaps(IntPtr hdc, int capindex); - - [DllImport("user32.dll")] - internal static extern IntPtr WindowFromPoint(int xPoint, int yPoint); - - [DllImport("user32.dll", SetLastError = true)] - internal static extern bool GetWindowRect(IntPtr hwnd, out Rect lpRect); - - [DllImport("dwmapi.dll")] - internal static extern int DwmGetWindowAttribute(IntPtr hwnd, int dwAttribute, out Rect pvAttribute, int cbAttribute); - - [DllImport("kernel32.dll")] - internal static extern int GetProcessId(IntPtr handle); - - [DllImport("dwmapi.dll", PreserveSig = false)] - internal static extern void DwmExtendFrameIntoClientArea(IntPtr hwnd, ref Margins margins); - - [DllImport("dwmapi.dll", PreserveSig = false)] - internal static extern bool DwmIsCompositionEnabled(); - - [DllImport("gdi32.dll")] - internal static extern bool PatBlt(IntPtr hdc, int nXLeft, int nYLeft, int nWidth, int nHeight, uint dwRop); - - [DllImport("user32.dll")] - internal static extern bool OffsetRect(ref Rect lprc, int dx, int dy); - - [DllImport("gdi32.dll")] - internal static extern bool GetCurrentPositionEx(IntPtr hdc, out POINT lpPoint); - - [DllImport("gdi32.dll")] - internal static extern bool GetWindowOrgEx(IntPtr hdc, out POINT lpPoint); - - [DllImport("user32.dll")] - internal static extern IntPtr MonitorFromWindow(IntPtr hwnd, uint dwFlags); - - [DllImport("user32.dll", SetLastError = true)] - static extern IntPtr MonitorFromPoint(POINT pt, uint dwFlags); - - [DllImport("user32.dll", CharSet = CharSet.Auto)] - internal static extern bool GetMonitorInfo(IntPtr hMonitor, ref MonitorInfoEx lpmi); - - [DllImport("shell32.dll", CharSet = CharSet.Unicode)] - static extern int SHGetKnownFolderPath([MarshalAs(UnmanagedType.LPStruct)] Guid rfid, uint dwFlags, IntPtr hToken, out string pszPath); - - [DllImport("user32.dll", CharSet = CharSet.Auto)] - internal static extern IntPtr SendMessage(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam); - - //[DllImport("SHCore.dll", SetLastError = true)] - //public static extern bool SetProcessDpiAwareness(PROCESS_DPI_AWARENESS awareness); - - //[DllImport("SHCore.dll", SetLastError = true)] - //public static extern void GetProcessDpiAwareness(IntPtr hprocess, out PROCESS_DPI_AWARENESS awareness); - - #endregion - - #region Methods - - /// - /// Captures the screen using the SourceCopy | CaptureBlt. - /// - /// The size of the final image. - /// Source capture Left position. - /// Source capture Top position. - /// A bitmap withe the capture rectangle. - public static BitmapSource CaptureBitmapSource(Size size, int positionX, int positionY) - { - var hDesk = GetDesktopWindow(); - var hSrce = GetWindowDC(hDesk); - var hDest = CreateCompatibleDC(hSrce); - var hBmp = CreateCompatibleBitmap(hSrce, (int)size.Width, (int)size.Height); - var hOldBmp = SelectObject(hDest, hBmp); - - var b = BitBlt(hDest, 0, 0, (int)size.Width, (int)size.Height, hSrce, positionX, positionY, CopyPixelOperation.SourceCopy | CopyPixelOperation.CaptureBlt); - - try - { - return Imaging.CreateBitmapSourceFromHBitmap(hBmp, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); - //return Image.FromHbitmap(hBmp); - } - catch (Exception ex) - { - //LogWriter.Log(ex, "Impossible to get screenshot of the screen"); - } - finally - { - SelectObject(hDest, hOldBmp); - DeleteObject(hBmp); - DeleteDC(hDest); - ReleaseDC(hDesk, hSrce); - } - - return null; - } - - /// - /// Captures the screen using the SourceCopy | CaptureBlt. - /// - /// The size of the final image. - /// Source capture Left position. - /// Source capture Top position. - /// A bitmap withe the capture rectangle. - public static System.Drawing.Image Capture(Size size, int positionX, int positionY) - { - var hDesk = GetDesktopWindow(); - var hSrce = GetWindowDC(hDesk); - var hDest = CreateCompatibleDC(hSrce); - var hBmp = CreateCompatibleBitmap(hSrce, (int)size.Width, (int)size.Height); - var hOldBmp = SelectObject(hDest, hBmp); - - try - { - new System.Security.Permissions.UIPermission(System.Security.Permissions.UIPermissionWindow.AllWindows).Demand(); - - var b = BitBlt(hDest, 0, 0, (int)size.Width, (int)size.Height, hSrce, positionX, positionY, CopyPixelOperation.SourceCopy | CopyPixelOperation.CaptureBlt); - - return b ? System.Drawing.Image.FromHbitmap(hBmp) : null; - } - catch (Exception ex) - { - //LogWriter.Log(ex, "Impossible to get screenshot of the screen"); - } - finally - { - SelectObject(hDest, hOldBmp); - DeleteObject(hBmp); - DeleteDC(hDest); - ReleaseDC(hDesk, hSrce); - } - - return null; - } - - /// - /// Draws a rectangle over a Window. - /// - /// The window handle. - public static void DrawFrame(IntPtr hWnd, double scale) - { - if (hWnd == IntPtr.Zero) - return; - - var hdc = GetWindowDC(hWnd); - - //TODO: Adjust for high DPI. - Rect rect; - GetWindowRect(hWnd, out rect); - //DwmGetWindowAttribute(hWnd, (int)DwmWindowAttribute.DwmwaExtendedFrameBounds, out rect, Marshal.SizeOf(typeof(Rect))); - OffsetRect(ref rect, -rect.Left, -rect.Top); - - const int frameWidth = 3; - - PatBlt(hdc, rect.Left, rect.Top, rect.Right - rect.Left, frameWidth, DstInvert); - - PatBlt(hdc, rect.Left, rect.Bottom - frameWidth, frameWidth, - -(rect.Bottom - rect.Top - 2 * frameWidth), DstInvert); - - PatBlt(hdc, rect.Right - frameWidth, rect.Top + frameWidth, frameWidth, - rect.Bottom - rect.Top - 2 * frameWidth, DstInvert); - - PatBlt(hdc, rect.Right, rect.Bottom - frameWidth, -(rect.Right - rect.Left), - frameWidth, DstInvert); - } - - private static bool ExtendedFrameBounds(IntPtr handle, out Int32Rect rectangle) - { - Rect rect; - var result = DwmGetWindowAttribute(handle, (int)DwmWindowAttribute.DwmwaExtendedFrameBounds, out rect, Marshal.SizeOf(typeof(Rect))); - - rectangle = rect.ToRectangle(); - - return result >= 0; - } - - private static Int32Rect GetWindowRect(IntPtr handle) - { - Rect rect; - GetWindowRect(handle, out rect); - return rect.ToRectangle(); - } - - public static Int32Rect TrueWindowRectangle(IntPtr handle) - { - Int32Rect rectangle; - return ExtendedFrameBounds(handle, out rectangle) ? rectangle : GetWindowRect(handle); - } - - internal static Size ScreenSizeFromWindow(Window window) - { - return ScreenSizeFromWindow(new WindowInteropHelper(window).Handle); - } - - internal static Size ScreenSizeFromWindow(IntPtr handle) - { - var pointer = MonitorFromWindow(handle, MonitorDefaultToNearest); - - var info = new MonitorInfoEx(); - GetMonitorInfo(pointer, ref info); - - var rect = info.rcWork.ToRectangle(); - - return new Size(rect.Width, rect.Height); - } - - internal static Size ScreenSizeFromPoint(int left, int top) - { - var pointer = MonitorFromPoint(new POINT { X = left, Y = top }, MonitorDefaultToNearest); - - var info = new MonitorInfoEx(); - GetMonitorInfo(pointer, ref info); - - var rect = info.rcWork.ToRectangle(); - - return new Size(rect.Width, rect.Height); - } - - internal static string GetKnowFolderPath(Guid knownFolder, bool defaultUser = false) - { - string path; - SHGetKnownFolderPath(knownFolder, (uint)KnownFolderFlags.DontVerify, new IntPtr(defaultUser ? -1 : 0), out path); - return path; - } - - #endregion - } -} diff --git a/RecordingTest/Properties/AssemblyInfo.cs b/RecordingTest/Properties/AssemblyInfo.cs deleted file mode 100644 index 884c7dfb..00000000 --- a/RecordingTest/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System.Reflection; -using System.Resources; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Windows; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("RecordingTest")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("RecordingTest")] -[assembly: AssemblyCopyright("Copyright © 2016")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -//In order to begin building localizable applications, set -//CultureYouAreCodingWith in your .csproj file -//inside a . For example, if you are using US english -//in your source files, set the to en-US. Then uncomment -//the NeutralResourceLanguage attribute below. Update the "en-US" in -//the line below to match the UICulture setting in the project file. - -//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] - - -[assembly: ThemeInfo( - ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located - //(used if a resource is not found in the page, - // or application resource dictionaries) - ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located - //(used if a resource is not found in the page, - // app, or any theme specific resource dictionaries) -)] - - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/RecordingTest/Properties/Resources.Designer.cs b/RecordingTest/Properties/Resources.Designer.cs deleted file mode 100644 index d7d32779..00000000 --- a/RecordingTest/Properties/Resources.Designer.cs +++ /dev/null @@ -1,71 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace RecordingTest.Properties -{ - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources - { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() - { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager - { - get - { - if ((resourceMan == null)) - { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("RecordingTest.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture - { - get - { - return resourceCulture; - } - set - { - resourceCulture = value; - } - } - } -} diff --git a/RecordingTest/Properties/Resources.resx b/RecordingTest/Properties/Resources.resx deleted file mode 100644 index af7dbebb..00000000 --- a/RecordingTest/Properties/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/RecordingTest/Properties/Settings.Designer.cs b/RecordingTest/Properties/Settings.Designer.cs deleted file mode 100644 index 83d6620f..00000000 --- a/RecordingTest/Properties/Settings.Designer.cs +++ /dev/null @@ -1,30 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace RecordingTest.Properties -{ - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default - { - get - { - return defaultInstance; - } - } - } -} diff --git a/RecordingTest/Properties/Settings.settings b/RecordingTest/Properties/Settings.settings deleted file mode 100644 index 033d7a5e..00000000 --- a/RecordingTest/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/RecordingTest/RecordingTest.csproj b/RecordingTest/RecordingTest.csproj deleted file mode 100644 index da4ac2bd..00000000 --- a/RecordingTest/RecordingTest.csproj +++ /dev/null @@ -1,108 +0,0 @@ - - - - - Debug - AnyCPU - {F8A50A82-90DB-49C4-9E38-1DC6746468D1} - WinExe - Properties - RecordingTest - RecordingTest - v4.5 - 512 - {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 4 - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - 4.0 - - - - - - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - App.xaml - Code - - - MainWindow.xaml - Code - - - - - - Code - - - True - True - Resources.resx - - - True - Settings.settings - True - - - ResXFileCodeGenerator - Resources.Designer.cs - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - - - - - - - \ No newline at end of file diff --git a/ScreenToGif/App.xaml b/ScreenToGif/App.xaml index 2153a36a..28373f10 100644 --- a/ScreenToGif/App.xaml +++ b/ScreenToGif/App.xaml @@ -447,8 +447,9 @@ -