This commit is contained in:
Frank Skare
2021-06-20 11:11:51 +02:00
parent aa94da9767
commit 93f0c970da
3 changed files with 25 additions and 3 deletions

View File

@@ -346,8 +346,19 @@ namespace mpvnet
mpv_event evt = (mpv_event)Marshal.PtrToStructure(ptr, typeof(mpv_event)); mpv_event evt = (mpv_event)Marshal.PtrToStructure(ptr, typeof(mpv_event));
if (WindowHandle == IntPtr.Zero) if (WindowHandle == IntPtr.Zero)
{
WindowHandle = Native.FindWindowEx(MainForm.Hwnd, IntPtr.Zero, "mpv", null); WindowHandle = Native.FindWindowEx(MainForm.Hwnd, IntPtr.Zero, "mpv", null);
int GWL_STYLE = -16;
uint WS_CHILD = 0x40000000;
uint WS_VISIBLE = 0x10000000;
uint WS_DISABLED = 0x08000000;
uint WS_CLIPSIBLINGS = 0x04000000;
Native.SetWindowLong(WindowHandle, GWL_STYLE,
WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_CLIPSIBLINGS);
}
try try
{ {
switch (evt.event_id) switch (evt.event_id)

View File

@@ -61,9 +61,6 @@ namespace mpvnet
int hi = result >> 8; int hi = result >> 8;
int lo = result & 0xFF; int lo = result & 0xFF;
if (lo == -1 || hi == -1)
return;
vk = lo; vk = lo;
if ((hi & 1) == 1) mod |= KeyModifiers.Shift; if ((hi & 1) == 1) mod |= KeyModifiers.Shift;

View File

@@ -68,6 +68,20 @@ namespace mpvnet
return GetWindowLong32(hWnd, nIndex); return GetWindowLong32(hWnd, nIndex);
} }
[DllImport("user32.dll", EntryPoint = "SetWindowLong")]
public static extern IntPtr SetWindowLong32(IntPtr hWnd, int nIndex, uint dwNewLong);
[DllImport("user32.dll", EntryPoint = "SetWindowLongPtr")]
public static extern IntPtr SetWindowLong64(IntPtr hWnd, int nIndex, uint dwNewLong);
public static IntPtr SetWindowLong(IntPtr hWnd, int nIndex, uint dwNewLong)
{
if (IntPtr.Size == 8)
return SetWindowLong64(hWnd, nIndex, dwNewLong);
else
return SetWindowLong32(hWnd, nIndex, dwNewLong);
}
[DllImport("gdi32.dll")] [DllImport("gdi32.dll")]
public static extern int GetDeviceCaps(IntPtr hdc, int nIndex); public static extern int GetDeviceCaps(IntPtr hdc, int nIndex);