Advertisement
RealLeon

BlockInput C# Winform

Jun 13th, 2022
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. put this in the middle of the public partial class
  2. -------------------------------------------------------------
  3.  
  4. [return: MarshalAs(UnmanagedType.Bool)]
  5. [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
  6. public static extern void BlockInput([In, MarshalAs(UnmanagedType.Bool)] bool fBlockIt);
  7. [DllImport("Gdi32.dll", EntryPoint = "CreateRoundRectRgn")]
  8.  
  9. private static extern IntPtr CreateRoundRectRgn
  10.  
  11. (
  12. int nLeftRect, // x-coordinate of upper-left corner
  13. int nTopRect, // y-coordinate of upper-left corner
  14. int nRightRect, // x-coordinate of lower-right corner
  15. int nBottomRect, // y-coordinate of lower-right corner
  16. int nWidthEllipse, // height of ellipse
  17. int nHeightEllipse // width of ellipse
  18. );
  19. int w = Screen.PrimaryScreen.Bounds.Width;
  20. int h = Screen.PrimaryScreen.Bounds.Height;
  21.  
  22. -------------------------------------------------------------------------------------
  23. And then type this
  24. this.Location = new Point(0, 0);
  25. Size = new Size(w, h);
  26. TopMost = true;
  27. Cursor.Hide();
  28. BlockInput(true);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement