Skip to content

Commit

Permalink
Merge pull request #54 from DanielHarrod/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
DanielHarrod authored Dec 28, 2024
2 parents bec08bf + bd02100 commit 4e05d69
Show file tree
Hide file tree
Showing 15 changed files with 2,282 additions and 2,264 deletions.
33 changes: 33 additions & 0 deletions AppTestStudio/API.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or(at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see<https://www.gnu.org/licenses/>.

using System;
using System.Data;
using System.Runtime.InteropServices;
using System.Text;
using static AppTestStudio.NativeMethods;
Expand Down Expand Up @@ -246,5 +247,37 @@ public enum DWMWINDOWATTRIBUTE : uint
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool EnumChildWindows(IntPtr window, EnumWindowProc callback, IntPtr lParam);

internal delegate bool EnumMonitorsDelegate(IntPtr hMonitor, IntPtr hdcMonitor, NativeMethods.RECT rect, IntPtr dwData);

[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool EnumDisplayMonitors(IntPtr hdc, IntPtr lprcClip, EnumMonitorsDelegate lpfnEnum, IntPtr dwData);

[DllImport("user32.dll", CharSet = CharSet.Auto)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool GetMonitorInfo(IntPtr hmonitor, [In, Out] NativeMethods.MONITORINFO info);

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto, Pack = 4)]
internal class MONITORINFO
{
internal int Size = Marshal.SizeOf(typeof(NativeMethods.MONITORINFO));
internal NativeMethods.RECT rcMonitor = new NativeMethods.RECT();
internal NativeMethods.RECT rcWork = new NativeMethods.RECT();
internal int dwFlags;
}

internal enum DpiType
{
Effective = 0,
Angular = 1,
Raw = 2,
}

[DllImport("Shcore.dll")]
internal static extern IntPtr GetDpiForMonitor([In] IntPtr hmonitor, [In] DpiType dpiType, [Out] out uint dpiX, [Out] out uint dpiY);

[DllImport("User32.dll")]
internal static extern IntPtr MonitorFromPoint([In] System.Drawing.Point pt, [In] uint dwFlags);

}
}
20 changes: 9 additions & 11 deletions AppTestStudio/AppTestStudio.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -93,20 +93,18 @@
<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="MouseKeyHook" Version="5.7.1" />
<PackageReference Include="OpenCvSharp4" Version="4.6.0.20220608" />
<PackageReference Include="OpenCvSharp4.Extensions" Version="4.6.0.20220608" />
<PackageReference Include="OpenCvSharp4.runtime.win" Version="4.6.0.20220608" />
<PackageReference Include="OpenCvSharp4.Windows" Version="4.6.0.20220608" />
<PackageReference Include="OpenCvSharp4" Version="4.10.0.20241108" />
<PackageReference Include="OpenCvSharp4.Extensions" Version="4.10.0.20241108" />
<PackageReference Include="OpenCvSharp4.runtime.win" Version="4.10.0.20241108" />
<PackageReference Include="OpenCvSharp4.Windows" Version="4.10.0.20241108" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
<PackageReference Include="Microsoft.AspNetCore.SystemWebAdapters" Version="1.3.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="8.0.0" />
<PackageReference Include="System.ServiceModel.Primitives" Version="6.2.0" />
<PackageReference Include="System.ServiceModel.Http" Version="6.2.0" />
<PackageReference Include="Microsoft.AspNetCore.SystemWebAdapters" Version="1.4.0" />
<PackageReference Include="System.ServiceModel.Primitives" Version="8.1.1" />
<PackageReference Include="System.ServiceModel.Http" Version="8.1.1" />
<PackageReference Include="System.ServiceModel.Duplex" Version="6.0.0" />
<PackageReference Include="System.ServiceModel.NetTcp" Version="6.2.0" />
<PackageReference Include="System.ServiceModel.NetTcp" Version="8.1.1" />
<PackageReference Include="System.ServiceModel.Security" Version="6.0.0" />
<PackageReference Include="System.ServiceModel.Federation" Version="6.2.0" />
<PackageReference Include="System.ServiceModel.Federation" Version="8.1.1" />
</ItemGroup>
<ItemGroup>
<Compile Remove="AppTestStudioApplicationContext.cs" />
Expand Down
7 changes: 7 additions & 0 deletions AppTestStudio/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -305,4 +305,11 @@ public enum CutCopyOption
Cut,
Copy
}

public static class MonitorFromPointFlags
{
public const uint MONITOR_DEFAULTTONULL = 0x00000000;
public const uint MONITOR_DEFAULTTOPRIMARY = 0x00000001;
public const uint MONITOR_DEFAULTTONEAREST = 0x00000002;
}
}
8 changes: 4 additions & 4 deletions AppTestStudio/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1455,25 +1455,25 @@ public static int HiLoWord(ushort lo, ushort hi)
[System.Diagnostics.DebuggerStepThrough]
public static int HiLoWord(int lo, int hi)
{
return HiLoWord((short)lo, (short)hi);
return HiLoWord((ushort)lo, (ushort)hi);
}

[System.Diagnostics.DebuggerStepThrough]
public static int HiLoWord(float lo, float hi)
{
return HiLoWord((short)lo, (short)hi);
return HiLoWord((ushort)lo, (ushort)hi);
}

[System.Diagnostics.DebuggerStepThrough]
public static IntPtr HiLoWordIntptr(short lo, short hi)
{
return new IntPtr(HiLoWord(lo, hi));
return new IntPtr(HiLoWord((ushort)lo, (ushort)hi));
}

[System.Diagnostics.DebuggerStepThrough]
public static IntPtr HiLoWordIntptr(int lo, int hi)
{
return new IntPtr(HiLoWord((short)lo, (short)hi));
return new IntPtr(HiLoWord((ushort)lo, (ushort)hi));
}

public static String CalculateDelay(int hour, int minute, int second, int ms)
Expand Down
Loading

0 comments on commit 4e05d69

Please sign in to comment.