1
0
mirror of https://github.com/ncblakely/GiantsTools synced 2024-11-16 19:55:36 +01:00
GiantsTools/Giants.Launcher/Native/NativeMethods.cs

75 lines
2.5 KiB
C#
Raw Normal View History

2020-08-10 06:58:51 +02:00
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace Giants.Launcher
{
static class NativeMethods
{
[DllImport("kernel32.dll")]
public static extern IntPtr LoadLibrary(string dllToLoad);
[DllImport("kernel32.dll")]
public static extern IntPtr GetProcAddress(IntPtr hModule, string procedureName);
[DllImport("kernel32.dll")]
public static extern bool FreeLibrary(IntPtr hModule);
[DllImport("user32.dll")]
public static extern bool SetForegroundWindow(IntPtr hWnd);
2020-08-13 06:58:53 +02:00
public const int WM_NCLBUTTONDOWN = 0xA1;
public const int HT_CAPTION = 0x2;
2020-08-10 06:58:51 +02:00
2020-08-13 06:58:53 +02:00
[DllImportAttribute("user32.dll")]
public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
[DllImportAttribute("user32.dll")]
public static extern bool ReleaseCapture();
2020-08-10 06:58:51 +02:00
2020-08-13 06:58:53 +02:00
[DllImport("user32.dll")]
public static extern bool EnumDisplaySettings(
string deviceName, int modeNum, ref DEVMODE devMode);
2020-08-10 06:58:51 +02:00
2020-08-13 06:58:53 +02:00
[StructLayout(LayoutKind.Sequential)]
public struct DEVMODE
{
2020-08-10 06:58:51 +02:00
2020-08-13 06:58:53 +02:00
private const int CCHDEVICENAME = 0x20;
private const int CCHFORMNAME = 0x20;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x20)]
public string dmDeviceName;
public short dmSpecVersion;
public short dmDriverVersion;
public short dmSize;
public short dmDriverExtra;
public int dmFields;
public int dmPositionX;
public int dmPositionY;
public ScreenOrientation dmDisplayOrientation;
public int dmDisplayFixedOutput;
public short dmColor;
public short dmDuplex;
public short dmYResolution;
public short dmTTOption;
public short dmCollate;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x20)]
public string dmFormName;
public short dmLogPixels;
public int dmBitsPerPel;
public int dmPelsWidth;
public int dmPelsHeight;
public int dmDisplayFlags;
public int dmDisplayFrequency;
public int dmICMMethod;
public int dmICMIntent;
public int dmMediaType;
public int dmDitherType;
public int dmReserved1;
public int dmReserved2;
public int dmPanningWidth;
public int dmPanningHeight;
2020-08-10 06:58:51 +02:00
2020-08-13 06:58:53 +02:00
}
2020-08-10 06:58:51 +02:00
}
}