forked from fdorg/flashdevelop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWin32.cs
More file actions
51 lines (41 loc) · 1.67 KB
/
Copy pathWin32.cs
File metadata and controls
51 lines (41 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace FlashDevelop
{
class Win32
{
public const Int32 SW_RESTORE = 9;
public const UInt32 SWP_SHOWWINDOW = 64;
[DllImport("user32.dll")]
public static extern Boolean IsIconic(IntPtr hWnd);
[DllImport("user32.dll")]
public static extern Boolean ShowWindow(IntPtr hWnd, Int32 nCmdShow);
[DllImport("user32.dll")]
public static extern void SetWindowPos(IntPtr hwnd, IntPtr hwndInsertAfter, Int32 x, Int32 y, Int32 width, Int32 height, UInt32 flags);
[DllImport("user32.dll")]
public static extern IntPtr SendMessage(IntPtr hWnd, Int32 msg, IntPtr wp, IntPtr lp);
[DllImport("user32.dll")]
public static extern IntPtr WindowFromPoint(Point pt);
/// <summary>
/// Sets the window specified by handle to fullscreen
/// </summary>
public static void SetWinFullScreen(IntPtr hwnd)
{
Screen screen = Screen.FromHandle(hwnd);
Int32 screenTop = screen.WorkingArea.Top;
Int32 screenLeft = screen.WorkingArea.Left;
Int32 screenWidth = screen.WorkingArea.Width;
Int32 screenHeight = screen.WorkingArea.Height;
Win32.SetWindowPos(hwnd, IntPtr.Zero, screenLeft, screenTop, screenWidth, screenHeight, Win32.SWP_SHOWWINDOW);
}
/// <summary>
/// Restores the window with Win32
/// </summary>
public static void RestoreWindow(IntPtr handle)
{
if (Win32.IsIconic(handle)) Win32.ShowWindow(handle, Win32.SW_RESTORE);
}
}
}