archive
/
usb-lockdown
Archived
1
Fork 0

form rename, and imported stuff from testing project

This commit is contained in:
Jake Howard 2014-08-10 22:44:46 +01:00
parent 9727c39b72
commit c04fdfb770
2 changed files with 106 additions and 0 deletions

57
USB Lockdown/lockScreen.Designer.cs generated Normal file
View File

@ -0,0 +1,57 @@
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;
}
}

View File

@ -0,0 +1,49 @@
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); }
}
}