diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a315183 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +################################################################################ +# This .gitignore file was automatically created by Microsoft(R) Visual Studio. +################################################################################ + +/.vs/RemoteDesktop/v15 +/RemoteDesktop/bin/Debug +/RemoteDesktop/obj/Debug diff --git a/RemoteDesktop/Form1.Designer.cs b/RemoteDesktop/Form1.Designer.cs index 4aa318b..daf1487 100644 --- a/RemoteDesktop/Form1.Designer.cs +++ b/RemoteDesktop/Form1.Designer.cs @@ -30,6 +30,8 @@ private void InitializeComponent() { this.exitBtn = new System.Windows.Forms.Button(); this.hideBtn = new System.Windows.Forms.Button(); + this.winDBtn = new System.Windows.Forms.Button(); + this.taskmgrBtn = new System.Windows.Forms.Button(); this.SuspendLayout(); // // exitBtn @@ -41,8 +43,9 @@ private void InitializeComponent() this.exitBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.exitBtn.ForeColor = System.Drawing.Color.White; this.exitBtn.Location = new System.Drawing.Point(0, 0); + this.exitBtn.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.exitBtn.Name = "exitBtn"; - this.exitBtn.Size = new System.Drawing.Size(160, 200); + this.exitBtn.Size = new System.Drawing.Size(147, 246); this.exitBtn.TabIndex = 0; this.exitBtn.Text = "Exit"; this.exitBtn.UseVisualStyleBackColor = false; @@ -57,26 +60,60 @@ private void InitializeComponent() this.hideBtn.FlatAppearance.BorderColor = System.Drawing.Color.Gray; this.hideBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.hideBtn.ForeColor = System.Drawing.Color.White; - this.hideBtn.Location = new System.Drawing.Point(160, 0); + this.hideBtn.Location = new System.Drawing.Point(279, 0); + this.hideBtn.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.hideBtn.Name = "hideBtn"; - this.hideBtn.Size = new System.Drawing.Size(160, 200); + this.hideBtn.Size = new System.Drawing.Size(147, 246); this.hideBtn.TabIndex = 1; this.hideBtn.Text = "Show Desktop"; this.hideBtn.UseVisualStyleBackColor = false; this.hideBtn.Click += new System.EventHandler(this.hideBtn_Click); // + // winDBtn + // + this.winDBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.winDBtn.FlatAppearance.BorderColor = System.Drawing.Color.Gray; + this.winDBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.winDBtn.ForeColor = System.Drawing.Color.White; + this.winDBtn.Location = new System.Drawing.Point(147, 0); + this.winDBtn.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.winDBtn.Name = "winDBtn"; + this.winDBtn.Size = new System.Drawing.Size(133, 123); + this.winDBtn.TabIndex = 2; + this.winDBtn.Text = "Win+D"; + this.winDBtn.UseVisualStyleBackColor = false; + // + // taskmgrBtn + // + this.taskmgrBtn.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left))); + this.taskmgrBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.taskmgrBtn.FlatAppearance.BorderColor = System.Drawing.Color.Gray; + this.taskmgrBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.taskmgrBtn.ForeColor = System.Drawing.Color.White; + this.taskmgrBtn.Location = new System.Drawing.Point(147, 123); + this.taskmgrBtn.Margin = new System.Windows.Forms.Padding(4); + this.taskmgrBtn.Name = "taskmgrBtn"; + this.taskmgrBtn.Size = new System.Drawing.Size(133, 123); + this.taskmgrBtn.TabIndex = 3; + this.taskmgrBtn.Text = "Taskmgr"; + this.taskmgrBtn.UseVisualStyleBackColor = false; + // // mainFrm // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.Black; - this.ClientSize = new System.Drawing.Size(320, 200); + this.ClientSize = new System.Drawing.Size(427, 246); + this.Controls.Add(this.taskmgrBtn); + this.Controls.Add(this.winDBtn); this.Controls.Add(this.hideBtn); this.Controls.Add(this.exitBtn); this.ForeColor = System.Drawing.SystemColors.ControlText; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.Location = new System.Drawing.Point(20, 20); - this.MinimumSize = new System.Drawing.Size(320, 200); + this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.MinimumSize = new System.Drawing.Size(427, 246); this.Name = "mainFrm"; this.Opacity = 0.8D; this.Text = "Remote Desktop"; @@ -89,6 +126,8 @@ private void InitializeComponent() private System.Windows.Forms.Button exitBtn; private System.Windows.Forms.Button hideBtn; + private System.Windows.Forms.Button winDBtn; + private System.Windows.Forms.Button taskmgrBtn; } } diff --git a/RemoteDesktop/Form1.cs b/RemoteDesktop/Form1.cs index 8086b07..daf9070 100644 --- a/RemoteDesktop/Form1.cs +++ b/RemoteDesktop/Form1.cs @@ -2,9 +2,13 @@ using System.Collections.Generic; using System.ComponentModel; using System.Data; +using System.Diagnostics; using System.Drawing; +using System.IO; using System.Linq; +using System.Runtime.InteropServices; using System.Text; +using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; @@ -12,9 +16,40 @@ namespace WindowsFormsApp2 { public partial class mainFrm : Form { + [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] + public static extern void keybd_event(uint bVk, uint bScan, uint dwFlags, uint dwExtraInfo); + + private const int KEYEVENTF_EXTENDEDKEY = 0x0001; + private const int KEYEVENTF_KEYUP = 0x0002; + private const int VK_LWIN = 0x5B; + private const int VK_D = 0x44; + private const int VK_LCONTROL = 0xA2; + private const int VK_LMENU = 0xA4; + private const int VK_TAB = 0x09; + public mainFrm() { InitializeComponent(); + winDBtn.Click += WinDBtn_Click; + taskmgrBtn.Click += TaskmgrBtn_Click; + } + + private void TaskmgrBtn_Click(object sender, EventArgs e) + { + ProcessStartInfo psi = new ProcessStartInfo(); + psi.FileName = "C:\\Windows\\System32\\cmd.exe"; + psi.Arguments = "/c taskmgr"; + psi.CreateNoWindow = true; + psi.UseShellExecute = false; + Process.Start(psi); + } + + private void WinDBtn_Click(object sender, EventArgs e) + { + keybd_event(VK_LWIN, 0, KEYEVENTF_EXTENDEDKEY | 0, 0); + keybd_event(VK_D, 0, KEYEVENTF_EXTENDEDKEY | 0, 0); + keybd_event(VK_D, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0); + keybd_event(VK_LWIN, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0); } private void exitBtn_Click(object sender, EventArgs e)