-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f6fd98c
commit 8d7af6d
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Add-Type @" | ||
using System; | ||
using System.Runtime.InteropServices; | ||
public class WindowAPI { | ||
[DllImport("user32.dll")] //we have to import this Dynamic link library as this contains methods for getting and setting window locations. | ||
[return: MarshalAs(UnmanagedType.Bool)] | ||
public static extern bool GetWindowRect( //Used to get Window coordinates | ||
IntPtr hWnd, out RECT lpRect); | ||
[DllImport("user32.dll")] | ||
[return: MarshalAs(UnmanagedType.Bool)] | ||
public extern static bool MoveWindow( //Used to move windows | ||
IntPtr handle, int x, int y, int width, int height, bool redraw); | ||
[DllImport("user32.dll")] | ||
[return: MarshalAs(UnmanagedType.Bool)] | ||
public static extern bool SetForegroundWindow(IntPtr hWnd); //Used to bring window to foreground :) | ||
} | ||
public struct RECT { | ||
public int Left; // x position of upper-left corner | ||
public int Top; // y position of upper-left corner | ||
public int Right; // x position of lower-right corner | ||
public int Bottom; // y position of lower-right corner | ||
} | ||
"@ |