Commit c04fdfb7 authored by Jake Howard's avatar Jake Howard
Browse files

form rename, and imported stuff from testing project

parent 9727c39b
namespace USB_Lockdown
{
partial class lockScreen
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.foregroundTimer = new System.Windows.Forms.Timer(this.components);
this.SuspendLayout();
//
// foregroundTimer
//
this.foregroundTimer.Interval = 50;
this.foregroundTimer.Tick += new System.EventHandler(this.keepForeground);
//
// lockScreen
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(284, 261);
this.Name = "lockScreen";
this.Text = "Form1";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.onClosing);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Timer foregroundTimer;
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace USB_Lockdown
{
public partial class lockScreen : Form
{
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool SetForegroundWindow(IntPtr hWnd);
public lockScreen()
{
InitializeComponent();
KeyboardLock.enable();
setupWindow();
}
private void setupWindow()
{
this.StartPosition = FormStartPosition.CenterScreen;
this.Height = SystemInformation.VirtualScreen.Height;
this.Width = SystemInformation.VirtualScreen.Width;
this.WindowState = FormWindowState.Maximized;
this.BackColor = Color.Black;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
SetForegroundWindow(this.Handle);
this.ShowInTaskbar = false;
}
private void onClosing(object sender, FormClosingEventArgs e)
{
if (e.CloseReason == CloseReason.UserClosing) { e.Cancel = true; } //disables alt+F4
}
private void keepForeground(object sender, EventArgs e) { SetForegroundWindow(this.Handle); }
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment