mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-01-11 07:15:28 +00:00
Use Marshal.GetLastWin32Error instead of GetLastError.
Also removes magic number 1171 and replaces with constant.
This commit is contained in:
parent
095d3f26c0
commit
fbe6cc0a31
|
@ -111,13 +111,6 @@ namespace OpenTK.Platform.Windows
|
|||
|
||||
internal static class Functions
|
||||
{
|
||||
#region GetLastError
|
||||
|
||||
[DllImport("Kernel32.dll")]
|
||||
internal static extern uint GetLastError();
|
||||
|
||||
#endregion
|
||||
|
||||
#region Window functions
|
||||
|
||||
#region SetWindowPos
|
||||
|
@ -1680,6 +1673,14 @@ namespace OpenTK.Platform.Windows
|
|||
|
||||
internal static readonly IntPtr HKEY_LOCAL_MACHINE = new IntPtr(unchecked((int)0x80000002));
|
||||
|
||||
// System Error Codes
|
||||
// http://msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx
|
||||
|
||||
/// <summary>
|
||||
/// The point passed to GetMouseMovePoints is not in the buffer.
|
||||
/// </summary>
|
||||
internal const int ERROR_POINT_NOT_FOUND = 1171;
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the points using the display resolution.
|
||||
/// </summary>
|
||||
|
|
|
@ -435,17 +435,17 @@ namespace OpenTK.Platform.Windows
|
|||
&movePoint, movePoints, numPoints,
|
||||
Constants.GMMP_USE_DISPLAY_POINTS);
|
||||
|
||||
uint lastError = Functions.GetLastError();
|
||||
int lastError = Marshal.GetLastWin32Error();
|
||||
|
||||
// No points returned or search point not found
|
||||
if (points == 0 || (points == -1 && lastError == 1171))
|
||||
if (points == 0 || (points == -1 && lastError == Constants.ERROR_POINT_NOT_FOUND))
|
||||
{
|
||||
// Just use the mouse move position
|
||||
mouse.Position = point;
|
||||
}
|
||||
else if (points == -1)
|
||||
{
|
||||
throw new System.ComponentModel.Win32Exception((int)lastError);
|
||||
throw new System.ComponentModel.Win32Exception(lastError);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue