public Form1(string[] args) { // // Required for Win Form Designer support // InitializeComponent(); CommandLine commandLine = new CommandLine(args); if (commandLine.SlashParams["/p"] != null) { string handleString = (string)commandLine.SlashParams["/p"]; int handle = Int32.Parse(handleString); bounceWnd = new BounceWnd(this, (IntPtr)handle, true); Visible = false; try { Win32RECT corners = new Win32RECT(); corners.GetWindowRect(handle); Console.WriteLine("Corners: {0}", corners); this.Height = corners.Height; this.Width = corners.Width; Console.WriteLine("height, width: {0} {1}", corners.Height, corners.Width); } catch (Exception e) { Console.WriteLine("Exception: {0}", e); } } else if (commandLine.SlashParams["/c"] != null) { firstPaint = false; } else { bounceWnd = new BounceWnd(this, this.Handle, false); // if it's full screen, change the size and the border... SetFullScreen(); Visible = true; } }
static extern bool GetWindowRectNative(int hwnd, ref Win32RECT corners);