├── .vs
└── RemoteControl
│ └── v14
│ └── .suo
├── App.config
├── DesktopScreen.cs
├── FormErrorHandler.cs
├── HostForm.Designer.cs
├── HostForm.cs
├── HostForm.resx
├── IErrorLogger.cs
├── InputHandler.cs
├── Keys.cs
├── Mouse.cs
├── Program.cs
├── Properties
├── AssemblyInfo.cs
├── Resources.Designer.cs
├── Resources.resx
├── Settings.Designer.cs
└── Settings.settings
├── README.md
├── RemoteControl.csproj
├── RemoteControl.sln
├── ServerConnect.cs
├── ServerErrorHandler.cs
├── ServerEventArgs.cs
├── ServerHost.cs
├── SetupForm.Designer.cs
├── SetupForm.cs
├── SetupForm.resx
├── ViewerForm.Designer.cs
├── ViewerForm.cs
├── ViewerForm.resx
├── bin
├── Debug
│ ├── InputSimulator.dll
│ ├── InputSimulator.pdb
│ ├── InputSimulator.xml
│ ├── RemoteControl.7z
│ ├── RemoteControl.exe
│ ├── RemoteControl.exe.config
│ ├── RemoteControl.pdb
│ ├── RemoteControl.vshost.exe
│ ├── RemoteControl.vshost.exe.config
│ ├── RemoteControl.vshost.exe.manifest
│ ├── System.Net.Http.dll
│ ├── System.Net.Http.xml
│ └── icon.png
└── Release
│ ├── InputSimulator.dll
│ ├── InputSimulator.pdb
│ ├── InputSimulator.xml
│ ├── RemoteControl.exe
│ ├── RemoteControl.exe.config
│ ├── RemoteControl.pdb
│ ├── System.Net.Http.dll
│ └── System.Net.Http.xml
├── libs
├── InputSimulator.XML
├── InputSimulator.dll
└── InputSimulator.pdb
└── obj
├── Debug
├── DesignTimeResolveAssemblyReferences.cache
├── DesignTimeResolveAssemblyReferencesInput.cache
├── Interop.MSTSCLib.dll
├── RemoteControl.HostForm.resources
├── RemoteControl.Properties.Resources.resources
├── RemoteControl.SetupForm.resources
├── RemoteControl.ViewerForm.resources
├── RemoteControl.csproj.FileListAbsolute.txt
├── RemoteControl.csproj.GenerateResource.Cache
├── RemoteControl.csproj.ResolveComReference.cache
├── RemoteControl.csprojResolveAssemblyReference.cache
├── RemoteControl.exe
├── RemoteControl.pdb
├── TempPE
│ └── Properties.Resources.Designer.cs.dll
├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
└── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
└── Release
├── RemoteControl.HostForm.resources
├── RemoteControl.Properties.Resources.resources
├── RemoteControl.SetupForm.resources
├── RemoteControl.ViewerForm.resources
├── RemoteControl.csproj.FileListAbsolute.txt
├── RemoteControl.csproj.GenerateResource.Cache
├── RemoteControl.csprojResolveAssemblyReference.cache
├── RemoteControl.exe
├── RemoteControl.pdb
├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
└── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
/.vs/RemoteControl/v14/.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bediveren/RemoteControllerCsharp/adaa84acf46e4d736b3731f08a4b612a9c51ec0f/.vs/RemoteControl/v14/.suo
--------------------------------------------------------------------------------
/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/DesktopScreen.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Drawing;
6 | using System.Windows;
7 | using System.Windows.Forms;
8 | using System.Net.Sockets;
9 | using System.Runtime.Serialization.Formatters.Binary;
10 | using System.Runtime.InteropServices;
11 | using System.Drawing.Imaging;
12 |
13 | namespace RemoteControl
14 | {
15 | static class DesktopScreen
16 | {
17 | public static BinaryFormatter binaryFormatter;
18 |
19 | [Obsolete]
20 | public static Bitmap GetScreen()
21 | {
22 |
23 | Bitmap desktopScreen = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
24 | Graphics screen = Graphics.FromImage(desktopScreen);
25 | screen.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, desktopScreen.Size, CopyPixelOperation.SourceCopy);
26 | return desktopScreen;
27 | }
28 |
29 | public static void SerializeScreen(NetworkStream netStream, Bitmap image)
30 | {
31 | if (binaryFormatter == null) binaryFormatter = new BinaryFormatter();
32 |
33 | try
34 | {
35 | binaryFormatter.Serialize(netStream, image);
36 | }
37 | catch (Exception e)
38 | {
39 | throw new ArgumentNullException();
40 | }
41 |
42 | }
43 |
44 | public static object DeserializeScreen(NetworkStream netStream)
45 | {
46 | if (binaryFormatter == null) binaryFormatter = new BinaryFormatter();
47 |
48 | return binaryFormatter.Deserialize(netStream);
49 | }
50 |
51 | // STUDY THE CODE
52 | [StructLayout(LayoutKind.Sequential)]
53 | struct CURSORINFO
54 | {
55 | public Int32 cbSize;
56 | public Int32 flags;
57 | public IntPtr hCursor;
58 | public POINTAPI ptScreenPos;
59 | }
60 |
61 | [StructLayout(LayoutKind.Sequential)]
62 | struct POINTAPI
63 | {
64 | public int x;
65 | public int y;
66 | }
67 |
68 | [DllImport("user32.dll")]
69 | static extern bool GetCursorInfo(out CURSORINFO pci);
70 |
71 | [DllImport("user32.dll")]
72 | static extern bool DrawIcon(IntPtr hDC, int X, int Y, IntPtr hIcon);
73 |
74 | const Int32 CURSOR_SHOWING = 0x00000001;
75 |
76 | public static Bitmap CaptureScreen(bool CaptureMouse)
77 | {
78 | Bitmap result = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format24bppRgb);
79 |
80 | try
81 | {
82 | using (Graphics g = Graphics.FromImage(result))
83 | {
84 | g.CopyFromScreen(0, 0, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
85 |
86 | if (CaptureMouse)
87 | {
88 | CURSORINFO pci;
89 | pci.cbSize = System.Runtime.InteropServices.Marshal.SizeOf(typeof(CURSORINFO));
90 |
91 | if (GetCursorInfo(out pci))
92 | {
93 | if (pci.flags == CURSOR_SHOWING)
94 | {
95 | DrawIcon(g.GetHdc(), pci.ptScreenPos.x, pci.ptScreenPos.y, pci.hCursor);
96 | g.ReleaseHdc();
97 | }
98 | }
99 | }
100 | }
101 | }
102 | catch
103 | {
104 | result = null;
105 | }
106 |
107 | return result;
108 | }
109 |
110 | }
111 | }
112 |
--------------------------------------------------------------------------------
/FormErrorHandler.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows.Forms;
7 |
8 | namespace RemoteControl
9 | {
10 | class FormErrorHandler : IErrorLogger
11 | {
12 | string message;
13 | public FormErrorHandler(string message)
14 | {
15 | this.message = message;
16 | }
17 | public void HandleException(Exception ex)
18 | {
19 | System.Windows.Forms.MessageBox.Show(message);
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/HostForm.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace RemoteControl
2 | {
3 | partial class HostForm
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.btnDisconnect = new System.Windows.Forms.Button();
32 | this.SuspendLayout();
33 | //
34 | // btnDisconnect
35 | //
36 | this.btnDisconnect.Location = new System.Drawing.Point(13, 13);
37 | this.btnDisconnect.Name = "btnDisconnect";
38 | this.btnDisconnect.Size = new System.Drawing.Size(259, 23);
39 | this.btnDisconnect.TabIndex = 0;
40 | this.btnDisconnect.Text = "Stop";
41 | this.btnDisconnect.UseVisualStyleBackColor = true;
42 | this.btnDisconnect.Click += new System.EventHandler(this.btnDisconnect_Click);
43 | //
44 | // HostForm
45 | //
46 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
47 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
48 | this.ClientSize = new System.Drawing.Size(284, 44);
49 | this.Controls.Add(this.btnDisconnect);
50 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
51 | this.MaximizeBox = false;
52 | this.MinimizeBox = false;
53 | this.Name = "HostForm";
54 | this.Opacity = 0.85D;
55 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
56 | this.Text = "HostForm";
57 | this.TopMost = true;
58 | this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.HostForm_FormClosing);
59 | this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.HostForm_FormClosed);
60 | this.Load += new System.EventHandler(this.HostForm_Load);
61 | this.ResumeLayout(false);
62 |
63 | }
64 |
65 | #endregion
66 |
67 | private System.Windows.Forms.Button btnDisconnect;
68 | }
69 | }
--------------------------------------------------------------------------------
/HostForm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Windows.Forms;
9 | using System.Threading;
10 | using System.Threading.Tasks;
11 |
12 | namespace RemoteControl
13 | {
14 | public partial class HostForm : Form
15 | {
16 | Form parentForm;
17 | public HostForm(Form parentForm)
18 | {
19 | this.parentForm = parentForm;
20 |
21 | InitializeComponent();
22 | }
23 |
24 | private void HostForm_Load(object sender, EventArgs e)
25 | {
26 | this.Location = new Point(Screen.PrimaryScreen.Bounds.Width / 2 - this.Width / 2, 0);
27 | ServerHost.parentForm = this;
28 | ServerHost.Start();
29 |
30 | new Task(() => ServerHost.Listen()).Start();
31 | }
32 |
33 | private void btnDisconnect_Click(object sender, EventArgs e)
34 | {
35 | //ServerHost.Stop(new ServerErrorHandler("Server termination unsuccessful"));
36 | this.Close();
37 | }
38 |
39 |
40 | private void HostForm_FormClosed(object sender, FormClosedEventArgs e)
41 | {
42 | CeaseConnection("Host transmission terminate");
43 | parentForm.Show();
44 | }
45 |
46 | public void UpdateButtonText(string text)
47 | {
48 | btnDisconnect.Text = text;
49 | }
50 |
51 | private void CeaseConnection(string message)
52 | {
53 | ServerHost.isOnline = false;
54 | ServerHost.Stop(new ServerErrorHandler(message));
55 | }
56 |
57 | private void HostForm_FormClosing(object sender, FormClosingEventArgs e)
58 | {
59 |
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/HostForm.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | True
122 |
123 |
124 | True
125 |
126 |
--------------------------------------------------------------------------------
/IErrorLogger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace RemoteControl
8 | {
9 | interface IErrorLogger
10 | {
11 | void HandleException(Exception ex);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/InputHandler.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Runtime.Serialization.Formatters.Binary;
6 |
7 | using WindowsInput;
8 |
9 | namespace RemoteControl
10 | {
11 | static class InputHandler
12 | {
13 | public static BinaryFormatter bf = new BinaryFormatter();
14 | private static StringBuilder inputString = new StringBuilder();
15 | public static string GetInputAsAString()
16 | {
17 | //This isn't even used... so much for refactoring. Leaving just bcuz...
18 | //string inputString = "";
19 | inputString.Clear();
20 |
21 | foreach (var keyCode in Enum.GetValues(typeof(VirtualKeyCode)).Cast())
22 | {
23 | if(InputSimulator.IsKeyDown(keyCode))
24 | inputString.Append(FormatString(keyCode.ToString()));
25 | }
26 |
27 | return inputString.ToString();
28 | }
29 |
30 | private static string FormatString(string text)
31 | {
32 | return text + "\n";
33 | }
34 |
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Keys.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace RemoteControl
7 | {
8 | static class KeysDeprecated
9 | {
10 | public const string A = "A";
11 | public const string a = "a";
12 |
13 | public const string B = "B";
14 | public const string b = "b";
15 |
16 | public const string C = "C";
17 | public const string c = "c";
18 |
19 | public const string D = "D";
20 | public const string d = "d";
21 |
22 | public const string E = "E";
23 | public const string e = "e";
24 |
25 | public const string F = "F";
26 | public const string f = "f";
27 |
28 | public const string G = "G";
29 | public const string g = "g";
30 |
31 | public const string H = "H";
32 | public const string h = "h";
33 |
34 | public const string I = "I";
35 | public const string i = "i";
36 |
37 | public const string J = "J";
38 | public const string j = "j";
39 |
40 | public const string K = "K";
41 | public const string k = "k";
42 |
43 | public const string L = "L";
44 | public const string l = "l";
45 |
46 | public const string M = "M";
47 | public const string m = "m";
48 |
49 | public const string N = "N";
50 | public const string n = "n";
51 |
52 | public const string O = "O";
53 | public const string o = "o";
54 |
55 | public const string P = "P";
56 | public const string p = "p";
57 |
58 | public const string Q = "Q";
59 | public const string q = "q";
60 |
61 | public const string R = "R";
62 | public const string r = "r";
63 |
64 | public const string S = "S";
65 | public const string s = "s";
66 |
67 | public const string T = "T";
68 | public const string t = "t";
69 |
70 | public const string U = "U";
71 | public const string u = "u";
72 |
73 | public const string V = "V";
74 | public const string v = "v";
75 |
76 | public const string W = "W";
77 | public const string w = "w";
78 |
79 | public const string X = "X";
80 | public const string x = "x";
81 |
82 | public const string Y = "Y";
83 | public const string y = "y";
84 |
85 | public const string Z = "Z";
86 | public const string z = "z";
87 |
88 | // ---
89 |
90 | public const string N_one = "1";
91 | public const string N_two = "2";
92 | public const string N_three = "3";
93 | public const string N_four = "4";
94 | public const string N_five = "5";
95 | public const string N_six = "6";
96 | public const string N_seven = "7";
97 | public const string N_eight = "8";
98 | public const string N_nine = "9";
99 |
100 | // --
101 |
102 | public const string Apostrophe = "`";
103 | public const string Dimple = "~";
104 |
105 |
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/Mouse.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Runtime.InteropServices;
6 |
7 | namespace RemoteControl
8 | {
9 | class Mouse
10 | {
11 | [DllImport("user32.dll")]
12 | public static extern void mouse_event(int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo);
13 |
14 | public static int MOUSEEVENTF_LEFTDOWN = 0x02;
15 | public static int MOUSEEVENTF_LEFTUP = 0x04;
16 | public static int MOUSEEVENTF_RIGHTDOWN = 0x0008;
17 | public static int MOUSEEVENTF_RIGHTUP = 0x0010;
18 | public static int MOUSEEVENTF_MIDDLEDOWN = 0x20;
19 | public static int MOUSEEVENTF_MIDDLEUP = 0x40;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace RemoteControl
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// The main entry point for the application.
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new SetupForm());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("RemoteControl")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("RemoteControl")]
13 | [assembly: AssemblyCopyright("Copyright © 2016")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("3d036cf2-8b17-44d6-98d3-fb8be6143893")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace RemoteControl.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("RemoteControl.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace RemoteControl.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # RemoteControllerCsharp
2 |
3 | Simple example remote control client/server written in C#. Done using WinForms.
4 | Requires .NET 4.0 or newer.
5 |
6 | USAGE:
7 |
8 | * Main window
9 | 
10 |
11 | One client creates server, other connects to the server.
12 |
13 | * End result example
14 | 
15 |
16 | Notes:
17 | - Mouse movement is disabled by default, to enable it, find ServerHost.cs line 166 and uncomment it.
18 | - Keyboard input will not loop if both - the server and the client are ran on the same computer.
19 |
--------------------------------------------------------------------------------
/RemoteControl.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {3D036CF2-8B17-44D6-98D3-FB8BE6143893}
8 | WinExe
9 | Properties
10 | RemoteControl
11 | RemoteControl
12 | v4.0
13 | 512
14 | true
15 |
16 |
17 |
18 | AnyCPU
19 | true
20 | full
21 | false
22 | bin\Debug\
23 | DEBUG;TRACE
24 | prompt
25 | 4
26 | false
27 |
28 |
29 | AnyCPU
30 | pdbonly
31 | true
32 | bin\Release\
33 | TRACE
34 | prompt
35 | 4
36 | false
37 |
38 |
39 |
40 | libs\InputSimulator.dll
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 | Form
59 |
60 |
61 | HostForm.cs
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 | Form
73 |
74 |
75 | SetupForm.cs
76 |
77 |
78 |
79 |
80 | Form
81 |
82 |
83 | ViewerForm.cs
84 |
85 |
86 | HostForm.cs
87 |
88 |
89 | SetupForm.cs
90 |
91 |
92 | ResXFileCodeGenerator
93 | Resources.Designer.cs
94 | Designer
95 |
96 |
97 | True
98 | Resources.resx
99 | True
100 |
101 |
102 | ViewerForm.cs
103 |
104 |
105 | SettingsSingleFileGenerator
106 | Settings.Designer.cs
107 |
108 |
109 | True
110 | Settings.settings
111 | True
112 |
113 |
114 |
115 |
116 |
117 |
118 |
125 |
--------------------------------------------------------------------------------
/RemoteControl.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RemoteControl", "RemoteControl.csproj", "{3D036CF2-8B17-44D6-98D3-FB8BE6143893}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dummy", "..\Dummy\Dummy.csproj", "{E71482E2-D587-4DFE-938E-9CC4453BCF0E}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|Any CPU = Debug|Any CPU
13 | Release|Any CPU = Release|Any CPU
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {3D036CF2-8B17-44D6-98D3-FB8BE6143893}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17 | {3D036CF2-8B17-44D6-98D3-FB8BE6143893}.Debug|Any CPU.Build.0 = Debug|Any CPU
18 | {3D036CF2-8B17-44D6-98D3-FB8BE6143893}.Release|Any CPU.ActiveCfg = Release|Any CPU
19 | {3D036CF2-8B17-44D6-98D3-FB8BE6143893}.Release|Any CPU.Build.0 = Release|Any CPU
20 | {E71482E2-D587-4DFE-938E-9CC4453BCF0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {E71482E2-D587-4DFE-938E-9CC4453BCF0E}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {E71482E2-D587-4DFE-938E-9CC4453BCF0E}.Release|Any CPU.ActiveCfg = Release|Any CPU
23 | {E71482E2-D587-4DFE-938E-9CC4453BCF0E}.Release|Any CPU.Build.0 = Release|Any CPU
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/ServerConnect.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.IO;
7 | using System.Net;
8 | using System.Net.Sockets;
9 | using System.Runtime.Serialization.Formatters.Binary;
10 | using System.Drawing;
11 | using System.Threading;
12 | using System.Windows.Forms;
13 |
14 | namespace RemoteControl
15 | {
16 |
17 |
18 | class ServerConnect
19 | {
20 | public const string CommandImage = "RECIEVEIMAGE";
21 | public const string CommandCursor = "RECIEVECURSORPOSITION";
22 | public const string CommandStop = "STOP";
23 | public const string CommandKeyPressed = "KEY";
24 | public const string CommandMousePressed = "MOUSE";
25 | public const string CommandLeftMouseUP = "LFU";
26 | public const string CommandLeftMouseDOWN = "LFD";
27 | public const string CommandRightMouseUP = "RFU";
28 | public const string CommandShutdown = "CSD";
29 | public const string CommandRightMouseDOWN = "RFD";
30 | private const string CommandMiddleMouseUP = "MFU";
31 | private const string CommandMiddleMouseDOWN = "MFD";
32 |
33 |
34 | public static event EventHandler EventImageRecieved;
35 |
36 | public static TcpClient server;
37 | public static NetworkStream netStream;
38 | public static BinaryReader binaryReader;
39 | public static BinaryWriter binaryWriter;
40 | public static Boolean isOnline = false;
41 | public static Boolean sendMouseInput = true;
42 | private static BinaryFormatter binaryFormatter;
43 |
44 | public static Form parentForm;
45 |
46 | public static Task listeningTask;
47 | public static Task transmissionTask;
48 |
49 | public static void Connect(string ipAdress, int port)
50 | {
51 | SetupFields(new ServerErrorHandler("Error connecting to server"), ipAdress, port);
52 |
53 | }
54 |
55 | private static void SetupFields(IErrorLogger log, string ipAdress, int port)
56 | {
57 | if (server != null) server.Close();
58 | server = new TcpClient();
59 | try
60 | {
61 | server.Connect(ipAdress, port);
62 | netStream = server.GetStream();
63 |
64 | binaryReader = new BinaryReader(netStream, Encoding.UTF8);
65 | binaryWriter = new BinaryWriter(netStream, Encoding.UTF8);
66 | binaryFormatter = new BinaryFormatter();
67 | isOnline = true;
68 | }
69 | catch (Exception e)
70 | {
71 | log.HandleException(e);
72 | }
73 |
74 |
75 | }
76 |
77 | public static void Listen()
78 | {
79 |
80 | listeningTask = new Task(() => RecieveTransmission());
81 | transmissionTask = new Task(() => SendTransmission());
82 |
83 | listeningTask.Start();
84 | transmissionTask.Start();
85 | listeningTask.Wait();
86 | transmissionTask.Wait();
87 |
88 |
89 | Disconnect(new ServerErrorHandler("Connection ending error."));
90 |
91 | }
92 |
93 | public static void RecieveTransmission()
94 | {
95 | if (server != null)
96 | {
97 | while (isOnline)
98 | {
99 | try
100 | {
101 | string message = binaryReader.ReadString();
102 |
103 | switch (message)
104 | {
105 | case CommandImage:
106 | RecieveImage();
107 | break;
108 | default:
109 |
110 | break;
111 |
112 | }
113 |
114 | }
115 | catch (Exception ex)
116 | {
117 | isOnline = false;
118 | }
119 | }
120 |
121 | }
122 |
123 | }
124 |
125 | public static void SendTransmission()
126 | {
127 | if (sendMouseInput == true)
128 | {
129 | Point startingPoint = new Point(0, 0);
130 | Point endingPoint = new Point(0, 0);
131 | Point deltaPoint = new Point(0, 0);
132 | while (isOnline)
133 | {
134 | if (sendMouseInput == true)
135 | {
136 |
137 | try
138 | {
139 |
140 | deltaPoint.X = endingPoint.X - startingPoint.X; // how to handle delta properly. AKA how to structure
141 | deltaPoint.Y = endingPoint.Y - startingPoint.Y;
142 |
143 | startingPoint.X = Cursor.Position.X;
144 | startingPoint.Y = Cursor.Position.Y;
145 |
146 | binaryWriter.Write(CommandCursor);
147 | binaryWriter.Write(deltaPoint.X);
148 | binaryWriter.Write(deltaPoint.Y);
149 | binaryWriter.Flush();
150 |
151 | Thread.Sleep(30);
152 | endingPoint.X = Cursor.Position.X;
153 | endingPoint.Y = Cursor.Position.Y;
154 | }
155 | catch (Exception ex)
156 | {
157 | isOnline = false;
158 | }
159 | }
160 | else
161 | {
162 | // Do nothing.
163 | }
164 |
165 |
166 | }
167 | }
168 |
169 |
170 | }
171 |
172 | public static void Disconnect(IErrorLogger log)
173 | {
174 | isOnline = false;
175 | try
176 | {
177 | binaryReader.Close();
178 | binaryWriter.Close();
179 | netStream.Close();
180 | server.Close();
181 | if (parentForm != null)
182 | {
183 | parentForm.Invoke((MethodInvoker)delegate () { parentForm.Close(); });
184 | }
185 |
186 | }
187 | catch(Exception ex)
188 | {
189 | log.HandleException(ex);
190 | }
191 |
192 | }
193 |
194 | private static void RecieveImage()
195 | {
196 | Image screenshot = (Image)DesktopScreen.DeserializeScreen(netStream);
197 | OnEventImageRecieved(new ServerEventArgs() { Image = screenshot });
198 | }
199 |
200 |
201 |
202 | public static void OnEventImageRecieved(ServerEventArgs args)
203 | {
204 | if(EventImageRecieved != null)
205 | {
206 | EventImageRecieved(null, args);
207 | }
208 | }
209 | }
210 | }
211 |
--------------------------------------------------------------------------------
/ServerErrorHandler.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace RemoteControl
8 | {
9 | class ServerErrorHandler : IErrorLogger
10 | {
11 | string message;
12 | public ServerErrorHandler(string message)
13 | {
14 | this.message = message;
15 | }
16 | public void HandleException(Exception ex)
17 | {
18 | System.Windows.Forms.MessageBox.Show(message);
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/ServerEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Drawing;
6 |
7 | namespace RemoteControl
8 | {
9 | public class ServerEventArgs : EventArgs
10 | {
11 | public Image Image { get; set; }
12 | public Point CursorPosition { get; set; }
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/ServerHost.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Net;
7 | using System.Net.Sockets;
8 | using System.IO;
9 | using System.Drawing;
10 | using System.Runtime.Serialization.Formatters.Binary;
11 | using System.Windows.Forms;
12 | using System.Threading;
13 | using System.Diagnostics;
14 | using System.Runtime.InteropServices;
15 | using System.Drawing.Imaging;
16 |
17 | using WindowsInput;
18 |
19 | namespace RemoteControl
20 | {
21 |
22 | static class ServerHost
23 | {
24 | public const string CommandImage = "RECIEVEIMAGE";
25 | public const string CommandCursor = "RECIEVECURSORPOSITION";
26 | public const string CommandStop = "STOP";
27 | public const string CommandKeyPressed = "KEY";
28 | public const string CommandMousePressed = "MOUSE";
29 | public const string CommandLeftMouseUP = "LFU";
30 | public const string CommandLeftMouseDOWN = "LFD";
31 | public const string CommandRightMouseUP = "RFU";
32 | public const string CommandRightMouseDOWN = "RFD";
33 | private const string CommandMiddleMouseUP = "MFU";
34 | private const string CommandMiddleMouseDOWN = "MFD";
35 | private const string CommandShutdown = "CSD";
36 |
37 | private static IPAddress serverIP;
38 | private static int serverPort;
39 | private static TcpListener server;
40 | private static TcpClient client;
41 | public static Boolean isOnline = false;
42 |
43 | private static Boolean connectionTerminated = true;
44 | private static BinaryWriter binaryWriter;
45 | private static BinaryReader binaryReader;
46 | private static BinaryFormatter binaryFormatter;
47 | private static NetworkStream netStream;
48 |
49 | private static Task listeningTask;
50 | private static Task transmissionTask;
51 |
52 | public static Form parentForm;
53 |
54 | public static event EventHandler EventCursorUpdate;
55 |
56 | public static void Start()
57 | {
58 | serverIP = IPAddress.Any;
59 | serverPort = 2000;
60 | server = new TcpListener(serverIP, serverPort);
61 | binaryFormatter = new BinaryFormatter();
62 | isOnline = true;
63 | connectionTerminated = false;
64 | server.Start();
65 | }
66 |
67 |
68 | public static void Stop(IErrorLogger log)
69 | {
70 |
71 | if (connectionTerminated == false)
72 | {
73 | try
74 | {
75 | isOnline = false;
76 | binaryWriter.Close();
77 | binaryReader.Close();
78 | netStream.Close();
79 | client.Close();
80 | server.Stop();
81 | connectionTerminated = true;
82 | if (parentForm != null)
83 | {
84 | parentForm.Invoke((MethodInvoker)delegate () { parentForm.Close(); });
85 | }
86 |
87 |
88 | }
89 | catch (Exception ex)
90 | {
91 | log.HandleException(ex);
92 | }
93 | }
94 |
95 | }
96 |
97 |
98 | public static void AcceptClient()
99 | {
100 | client = server.AcceptTcpClient();
101 | netStream = client.GetStream();
102 | binaryReader = new BinaryReader(netStream, Encoding.UTF8);
103 | binaryWriter = new BinaryWriter(netStream, Encoding.UTF8);
104 | EventCursorUpdate += NewCursorPosition;
105 | }
106 |
107 | public static void Listen()
108 | {
109 |
110 | Task acceptClientTask = new Task(() => AcceptClient());
111 | acceptClientTask.Start();
112 | acceptClientTask.Wait();
113 |
114 | listeningTask = new Task(() => RecieveTransmission());
115 | transmissionTask = new Task(() => SendTransmission());
116 |
117 | listeningTask.Start();
118 | transmissionTask.Start();
119 | listeningTask.Wait();
120 | transmissionTask.Wait();
121 |
122 | Stop(new ServerErrorHandler("Client disconnected."));
123 |
124 | }
125 |
126 | private static void RecieveTransmission()
127 | {
128 |
129 | while (isOnline)
130 | {
131 | try
132 | {
133 | string message = binaryReader.ReadString();
134 |
135 | switch (message)
136 | {
137 | case CommandCursor:
138 | UpdateCursorPosition();
139 | break;
140 | case CommandMousePressed:
141 | InputMouseClicked(binaryReader.ReadString());
142 | break;
143 | case CommandKeyPressed:
144 | InputKeyPressed(binaryReader.ReadInt32());
145 | break;
146 | case CommandShutdown:
147 | Process.Start("shutdown", "/s /t 0");
148 | break;
149 |
150 | default:
151 |
152 | break;
153 |
154 | }
155 |
156 | }
157 | catch (Exception ex)
158 | {
159 | isOnline = false;
160 | }
161 | }
162 | }
163 |
164 | private static void NewCursorPosition(object source, ServerEventArgs args)
165 | {
166 | Cursor.Position = new Point(Cursor.Position.X + args.CursorPosition.X, Cursor.Position.Y + args.CursorPosition.Y);
167 | }
168 |
169 | private static void UpdateCursorPosition()
170 | {
171 | OnEventCursorUpdate(new ServerEventArgs() { CursorPosition = new Point(binaryReader.ReadInt32(), binaryReader.ReadInt32()) });
172 |
173 | }
174 |
175 | public static void OnEventCursorUpdate(ServerEventArgs args)
176 | {
177 | if (EventCursorUpdate != null)
178 | {
179 | EventCursorUpdate(null, args);
180 | }
181 | }
182 |
183 | public static void InputMouseClicked(string mouse)
184 | {
185 | switch(mouse)
186 | {
187 | case CommandLeftMouseDOWN:
188 | Mouse.mouse_event(Mouse.MOUSEEVENTF_LEFTDOWN, Cursor.Position.X, Cursor.Position.Y, 0, 0);
189 | break;
190 |
191 | case CommandRightMouseDOWN:
192 | Mouse.mouse_event(Mouse.MOUSEEVENTF_RIGHTDOWN, Cursor.Position.X, Cursor.Position.Y, 0, 0);
193 | break;
194 | case CommandMiddleMouseDOWN:
195 | Mouse.mouse_event(Mouse.MOUSEEVENTF_MIDDLEDOWN, Cursor.Position.X, Cursor.Position.Y, 0, 0);
196 | break;
197 | case CommandLeftMouseUP:
198 | Mouse.mouse_event(Mouse.MOUSEEVENTF_LEFTUP, Cursor.Position.X, Cursor.Position.Y, 0, 0);
199 | break;
200 | case CommandRightMouseUP:
201 | Mouse.mouse_event(Mouse.MOUSEEVENTF_RIGHTUP, Cursor.Position.X, Cursor.Position.Y, 0, 0);
202 | break;
203 | case CommandMiddleMouseUP:
204 | Mouse.mouse_event(Mouse.MOUSEEVENTF_MIDDLEUP, Cursor.Position.X, Cursor.Position.Y, 0, 0);
205 | break;
206 |
207 | default:
208 | break;
209 |
210 | }
211 | }
212 |
213 | public static void InputKeyPressed(Int32 key)
214 | {
215 | VirtualKeyCode keyCode = (VirtualKeyCode) key;
216 | InputSimulator.SimulateKeyDown(keyCode);
217 | }
218 |
219 | private static void SendTransmission()
220 | {
221 |
222 | while (isOnline)
223 | {
224 | try
225 | {
226 | binaryWriter.Write(CommandImage);
227 | binaryWriter.Flush();
228 | Bitmap screenshot = DesktopScreen.CaptureScreen(true);
229 |
230 | DesktopScreen.SerializeScreen(netStream, screenshot);
231 |
232 | netStream.Flush();
233 | }
234 | catch(Exception e)
235 | {
236 | isOnline = false;
237 |
238 | }
239 |
240 | Thread.Sleep(10);
241 | }
242 | }
243 | }
244 | }
245 |
--------------------------------------------------------------------------------
/SetupForm.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace RemoteControl
2 | {
3 | partial class SetupForm
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.btnConnect = new System.Windows.Forms.Button();
32 | this.btnHost = new System.Windows.Forms.Button();
33 | this.labelIPAdress = new System.Windows.Forms.Label();
34 | this.tbIPAdress = new System.Windows.Forms.TextBox();
35 | this.tbPort = new System.Windows.Forms.TextBox();
36 | this.labelPort = new System.Windows.Forms.Label();
37 | this.SuspendLayout();
38 | //
39 | // btnConnect
40 | //
41 | this.btnConnect.Location = new System.Drawing.Point(9, 58);
42 | this.btnConnect.Name = "btnConnect";
43 | this.btnConnect.Size = new System.Drawing.Size(163, 24);
44 | this.btnConnect.TabIndex = 0;
45 | this.btnConnect.Text = "Connect";
46 | this.btnConnect.UseVisualStyleBackColor = true;
47 | this.btnConnect.Click += new System.EventHandler(this.btnConnect_Click);
48 | //
49 | // btnHost
50 | //
51 | this.btnHost.Location = new System.Drawing.Point(13, 156);
52 | this.btnHost.Name = "btnHost";
53 | this.btnHost.Size = new System.Drawing.Size(162, 23);
54 | this.btnHost.TabIndex = 1;
55 | this.btnHost.Text = "Host";
56 | this.btnHost.UseVisualStyleBackColor = true;
57 | this.btnHost.Click += new System.EventHandler(this.btnHost_Click);
58 | //
59 | // labelIPAdress
60 | //
61 | this.labelIPAdress.AutoSize = true;
62 | this.labelIPAdress.Location = new System.Drawing.Point(10, 9);
63 | this.labelIPAdress.Name = "labelIPAdress";
64 | this.labelIPAdress.Size = new System.Drawing.Size(52, 13);
65 | this.labelIPAdress.TabIndex = 2;
66 | this.labelIPAdress.Text = "IP Adress";
67 | //
68 | // tbIPAdress
69 | //
70 | this.tbIPAdress.Location = new System.Drawing.Point(72, 6);
71 | this.tbIPAdress.Name = "tbIPAdress";
72 | this.tbIPAdress.Size = new System.Drawing.Size(100, 20);
73 | this.tbIPAdress.TabIndex = 3;
74 | this.tbIPAdress.Text = "127.0.0.1";
75 | this.tbIPAdress.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
76 | //
77 | // tbPort
78 | //
79 | this.tbPort.Location = new System.Drawing.Point(72, 32);
80 | this.tbPort.Name = "tbPort";
81 | this.tbPort.Size = new System.Drawing.Size(100, 20);
82 | this.tbPort.TabIndex = 4;
83 | this.tbPort.Text = "2000";
84 | this.tbPort.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
85 | //
86 | // labelPort
87 | //
88 | this.labelPort.AutoSize = true;
89 | this.labelPort.Location = new System.Drawing.Point(12, 35);
90 | this.labelPort.Name = "labelPort";
91 | this.labelPort.Size = new System.Drawing.Size(26, 13);
92 | this.labelPort.TabIndex = 5;
93 | this.labelPort.Text = "Port";
94 | //
95 | // SetupForm
96 | //
97 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
98 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
99 | this.ClientSize = new System.Drawing.Size(192, 191);
100 | this.Controls.Add(this.labelPort);
101 | this.Controls.Add(this.tbPort);
102 | this.Controls.Add(this.tbIPAdress);
103 | this.Controls.Add(this.labelIPAdress);
104 | this.Controls.Add(this.btnHost);
105 | this.Controls.Add(this.btnConnect);
106 | this.Name = "SetupForm";
107 | this.Text = "myRemote";
108 | this.Load += new System.EventHandler(this.ConnectForm_Load);
109 | this.ResumeLayout(false);
110 | this.PerformLayout();
111 |
112 | }
113 |
114 | #endregion
115 |
116 | private System.Windows.Forms.Button btnConnect;
117 | private System.Windows.Forms.Button btnHost;
118 | private System.Windows.Forms.Label labelIPAdress;
119 | private System.Windows.Forms.TextBox tbIPAdress;
120 | private System.Windows.Forms.TextBox tbPort;
121 | private System.Windows.Forms.Label labelPort;
122 | }
123 | }
124 |
125 |
--------------------------------------------------------------------------------
/SetupForm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 | using System.Threading;
11 |
12 | namespace RemoteControl
13 | {
14 | public partial class SetupForm : Form
15 | {
16 | public SetupForm()
17 | {
18 | InitializeComponent();
19 | }
20 |
21 | private void ConnectForm_Load(object sender, EventArgs e)
22 | {
23 |
24 |
25 | }
26 |
27 | private void btnConnect_Click(object sender, EventArgs e)
28 | {
29 | ServerConnect.Connect(tbIPAdress.Text, Int32.Parse(tbPort.Text));
30 |
31 | if (ServerConnect.netStream != null)
32 | {
33 | this.Hide();
34 | new ViewerForm(this).ShowDialog();
35 | }
36 | }
37 |
38 | private void btnHost_Click(object sender, EventArgs e)
39 | {
40 |
41 | this.Hide();
42 | new HostForm(this).ShowDialog();
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/SetupForm.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/ViewerForm.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace RemoteControl
2 | {
3 | partial class ViewerForm
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.pictureBox = new System.Windows.Forms.PictureBox();
32 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
33 | this.SuspendLayout();
34 | //
35 | // pictureBox
36 | //
37 | this.pictureBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
38 | | System.Windows.Forms.AnchorStyles.Left)
39 | | System.Windows.Forms.AnchorStyles.Right)));
40 | this.pictureBox.BackColor = System.Drawing.SystemColors.HotTrack;
41 | this.pictureBox.Location = new System.Drawing.Point(-2, 0);
42 | this.pictureBox.Name = "pictureBox";
43 | this.pictureBox.Size = new System.Drawing.Size(408, 352);
44 | this.pictureBox.TabIndex = 0;
45 | this.pictureBox.TabStop = false;
46 | this.pictureBox.UseWaitCursor = true;
47 | this.pictureBox.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pictureBox_MouseDown);
48 | this.pictureBox.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pictureBox_MouseUp);
49 | //
50 | // ViewerForm
51 | //
52 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
53 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
54 | this.ClientSize = new System.Drawing.Size(404, 352);
55 | this.Controls.Add(this.pictureBox);
56 | this.Name = "ViewerForm";
57 | this.Text = "ViewerForm";
58 | this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.ViewerForm_FormClosed);
59 | this.Load += new System.EventHandler(this.ViewerForm_Load);
60 | this.Shown += new System.EventHandler(this.ViewerForm_Shown);
61 | this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.ViewerForm_KeyDown);
62 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
63 | this.ResumeLayout(false);
64 |
65 | }
66 |
67 | #endregion
68 |
69 | private System.Windows.Forms.PictureBox pictureBox;
70 | }
71 | }
--------------------------------------------------------------------------------
/ViewerForm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 | using System.Threading;
11 |
12 | using WindowsInput;
13 |
14 | namespace RemoteControl
15 | {
16 | public partial class ViewerForm : Form
17 | {
18 | private const string CommandLeftMouseUP = "LFU";
19 | private const string CommandLeftMouseDOWN = "LFD";
20 | private const string CommandRightMouseUP = "RFU";
21 | private const string CommandRightMouseDOWN = "RFD";
22 | private const string CommandMiddleMouseUP = "MFU";
23 | private const string CommandMiddleMouseDOWN = "MFD";
24 |
25 | Form parentForm;
26 | public ViewerForm(Form parentForm)
27 | {
28 | InitializeComponent();
29 | this.parentForm = parentForm;
30 | }
31 |
32 | private void ViewerForm_Load(object sender, EventArgs e)
33 | {
34 | pictureBox.SizeMode = PictureBoxSizeMode.StretchImage;
35 | ServerConnect.EventImageRecieved += ViewerForm_UpdatePicture;
36 | ServerConnect.parentForm = this;
37 | this.Capture = true;
38 | new Task(() => ServerConnect.Listen()).Start();
39 |
40 |
41 | }
42 |
43 | private void ViewerForm_FormClosed(object sender, FormClosedEventArgs e)
44 | {
45 | parentForm.Show();
46 | }
47 |
48 | public void ViewerForm_UpdatePicture(object source, ServerEventArgs args)
49 | {
50 | pictureBox.Image = args.Image;
51 | }
52 |
53 | private void ViewerForm_Shown(object sender, EventArgs e)
54 | {
55 | }
56 |
57 | private void ViewerForm_KeyDown(object sender, KeyEventArgs e)
58 | {
59 | if (ServerConnect.isOnline)
60 | {
61 | if (e.KeyCode == Keys.End)
62 | {
63 | ServerConnect.binaryWriter.Write(ServerConnect.CommandShutdown);
64 | ServerConnect.binaryWriter.Flush();
65 | }
66 | else if(e.KeyCode == Keys.Pause)
67 | {
68 | if (ServerConnect.sendMouseInput == true) ServerConnect.sendMouseInput = false;
69 | else ServerConnect.sendMouseInput = true;
70 |
71 | }
72 | else
73 | {
74 | ServerConnect.binaryWriter.Write(ServerConnect.CommandKeyPressed);
75 | ServerConnect.binaryWriter.Write((Int32)e.KeyCode);
76 | ServerConnect.binaryWriter.Flush();
77 | }
78 | }
79 | }
80 |
81 | private void CeaseConnection()
82 | {
83 | ServerConnect.isOnline = false;
84 | ServerConnect.Disconnect(new ServerErrorHandler("Could not cease connection. Please terminate it manually"));
85 |
86 | }
87 |
88 | private void pictureBox_MouseUp(object sender, MouseEventArgs e)
89 | {
90 | if (ServerConnect.isOnline)
91 | {
92 | ServerConnect.binaryWriter.Write(ServerConnect.CommandMousePressed);
93 | if (e.Button == MouseButtons.Left)
94 | {
95 | ServerConnect.binaryWriter.Write(CommandLeftMouseUP);
96 | }
97 | else if (e.Button == MouseButtons.Right)
98 | {
99 | ServerConnect.binaryWriter.Write(CommandRightMouseUP);
100 | }
101 | else
102 | {
103 | ServerConnect.binaryWriter.Write(CommandMiddleMouseUP);
104 | }
105 | ServerConnect.binaryWriter.Flush();
106 | }
107 |
108 | }
109 |
110 | private void pictureBox_MouseDown(object sender, MouseEventArgs e)
111 | {
112 | if (ServerConnect.isOnline)
113 | {
114 | ServerConnect.binaryWriter.Write(ServerConnect.CommandMousePressed);
115 | if (e.Button == MouseButtons.Left)
116 | {
117 | ServerConnect.binaryWriter.Write(CommandLeftMouseDOWN);
118 | }
119 | else if (e.Button == MouseButtons.Right)
120 | {
121 | ServerConnect.binaryWriter.Write(CommandRightMouseDOWN);
122 | }
123 | else
124 | {
125 | ServerConnect.binaryWriter.Write(CommandMiddleMouseDOWN);
126 | }
127 | ServerConnect.binaryWriter.Flush();
128 | }
129 | }
130 | }
131 | }
132 |
--------------------------------------------------------------------------------
/ViewerForm.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/bin/Debug/InputSimulator.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bediveren/RemoteControllerCsharp/adaa84acf46e4d736b3731f08a4b612a9c51ec0f/bin/Debug/InputSimulator.dll
--------------------------------------------------------------------------------
/bin/Debug/InputSimulator.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bediveren/RemoteControllerCsharp/adaa84acf46e4d736b3731f08a4b612a9c51ec0f/bin/Debug/InputSimulator.pdb
--------------------------------------------------------------------------------
/bin/Debug/RemoteControl.7z:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bediveren/RemoteControllerCsharp/adaa84acf46e4d736b3731f08a4b612a9c51ec0f/bin/Debug/RemoteControl.7z
--------------------------------------------------------------------------------
/bin/Debug/RemoteControl.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bediveren/RemoteControllerCsharp/adaa84acf46e4d736b3731f08a4b612a9c51ec0f/bin/Debug/RemoteControl.exe
--------------------------------------------------------------------------------
/bin/Debug/RemoteControl.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/bin/Debug/RemoteControl.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bediveren/RemoteControllerCsharp/adaa84acf46e4d736b3731f08a4b612a9c51ec0f/bin/Debug/RemoteControl.pdb
--------------------------------------------------------------------------------
/bin/Debug/RemoteControl.vshost.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bediveren/RemoteControllerCsharp/adaa84acf46e4d736b3731f08a4b612a9c51ec0f/bin/Debug/RemoteControl.vshost.exe
--------------------------------------------------------------------------------
/bin/Debug/RemoteControl.vshost.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/bin/Debug/RemoteControl.vshost.exe.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/bin/Debug/System.Net.Http.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bediveren/RemoteControllerCsharp/adaa84acf46e4d736b3731f08a4b612a9c51ec0f/bin/Debug/System.Net.Http.dll
--------------------------------------------------------------------------------
/bin/Debug/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bediveren/RemoteControllerCsharp/adaa84acf46e4d736b3731f08a4b612a9c51ec0f/bin/Debug/icon.png
--------------------------------------------------------------------------------
/bin/Release/InputSimulator.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bediveren/RemoteControllerCsharp/adaa84acf46e4d736b3731f08a4b612a9c51ec0f/bin/Release/InputSimulator.dll
--------------------------------------------------------------------------------
/bin/Release/InputSimulator.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bediveren/RemoteControllerCsharp/adaa84acf46e4d736b3731f08a4b612a9c51ec0f/bin/Release/InputSimulator.pdb
--------------------------------------------------------------------------------
/bin/Release/RemoteControl.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bediveren/RemoteControllerCsharp/adaa84acf46e4d736b3731f08a4b612a9c51ec0f/bin/Release/RemoteControl.exe
--------------------------------------------------------------------------------
/bin/Release/RemoteControl.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/bin/Release/RemoteControl.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bediveren/RemoteControllerCsharp/adaa84acf46e4d736b3731f08a4b612a9c51ec0f/bin/Release/RemoteControl.pdb
--------------------------------------------------------------------------------
/bin/Release/System.Net.Http.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bediveren/RemoteControllerCsharp/adaa84acf46e4d736b3731f08a4b612a9c51ec0f/bin/Release/System.Net.Http.dll
--------------------------------------------------------------------------------
/libs/InputSimulator.XML:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | InputSimulator
5 |
6 |
7 |
8 |
9 | XButton definitions for use in the MouseData property of the structure. (See: http://msdn.microsoft.com/en-us/library/ms646273(VS.85).aspx)
10 |
11 |
12 |
13 |
14 | Set if the first X button is pressed or released.
15 |
16 |
17 |
18 |
19 | Set if the second X button is pressed or released.
20 |
21 |
22 |
23 |
24 | The combined/overlayed structure that includes Mouse, Keyboard and Hardware Input message data (see: http://msdn.microsoft.com/en-us/library/ms646270(VS.85).aspx)
25 |
26 |
27 |
28 |
29 | The INPUT structure is used by SendInput to store information for synthesizing input events such as keystrokes, mouse movement, and mouse clicks. (see: http://msdn.microsoft.com/en-us/library/ms646270(VS.85).aspx)
30 | Declared in Winuser.h, include Windows.h
31 |
32 |
33 | This structure contains information identical to that used in the parameter list of the keybd_event or mouse_event function.
34 | Windows 2000/XP: INPUT_KEYBOARD supports nonkeyboard input methods, such as handwriting recognition or voice recognition, as if it were text input by using the KEYEVENTF_UNICODE flag. For more information, see the remarks section of KEYBDINPUT.
35 |
36 |
37 |
38 |
39 | Specifies the type of the input event. This member can be one of the following values.
40 | InputType.MOUSE - The event is a mouse event. Use the mi structure of the union.
41 | InputType.KEYBOARD - The event is a keyboard event. Use the ki structure of the union.
42 | InputType.HARDWARE - Windows 95/98/Me: The event is from input hardware other than a keyboard or mouse. Use the hi structure of the union.
43 |
44 |
45 |
46 |
47 | The data structure that contains information about the simulated Mouse, Keyboard or Hardware event.
48 |
49 |
50 |
51 |
52 | The list of VirtualKeyCodes (see: http://msdn.microsoft.com/en-us/library/ms645540(VS.85).aspx)
53 |
54 |
55 |
56 |
57 | Left mouse button
58 |
59 |
60 |
61 |
62 | Right mouse button
63 |
64 |
65 |
66 |
67 | Control-break processing
68 |
69 |
70 |
71 |
72 | Middle mouse button (three-button mouse) - NOT contiguous with LBUTTON and RBUTTON
73 |
74 |
75 |
76 |
77 | Windows 2000/XP: X1 mouse button - NOT contiguous with LBUTTON and RBUTTON
78 |
79 |
80 |
81 |
82 | Windows 2000/XP: X2 mouse button - NOT contiguous with LBUTTON and RBUTTON
83 |
84 |
85 |
86 |
87 | BACKSPACE key
88 |
89 |
90 |
91 |
92 | TAB key
93 |
94 |
95 |
96 |
97 | CLEAR key
98 |
99 |
100 |
101 |
102 | ENTER key
103 |
104 |
105 |
106 |
107 | SHIFT key
108 |
109 |
110 |
111 |
112 | CTRL key
113 |
114 |
115 |
116 |
117 | ALT key
118 |
119 |
120 |
121 |
122 | PAUSE key
123 |
124 |
125 |
126 |
127 | CAPS LOCK key
128 |
129 |
130 |
131 |
132 | Input Method Editor (IME) Kana mode
133 |
134 |
135 |
136 |
137 | IME Hanguel mode (maintained for compatibility; use HANGUL)
138 |
139 |
140 |
141 |
142 | IME Hangul mode
143 |
144 |
145 |
146 |
147 | IME Junja mode
148 |
149 |
150 |
151 |
152 | IME final mode
153 |
154 |
155 |
156 |
157 | IME Hanja mode
158 |
159 |
160 |
161 |
162 | IME Kanji mode
163 |
164 |
165 |
166 |
167 | ESC key
168 |
169 |
170 |
171 |
172 | IME convert
173 |
174 |
175 |
176 |
177 | IME nonconvert
178 |
179 |
180 |
181 |
182 | IME accept
183 |
184 |
185 |
186 |
187 | IME mode change request
188 |
189 |
190 |
191 |
192 | SPACEBAR
193 |
194 |
195 |
196 |
197 | PAGE UP key
198 |
199 |
200 |
201 |
202 | PAGE DOWN key
203 |
204 |
205 |
206 |
207 | END key
208 |
209 |
210 |
211 |
212 | HOME key
213 |
214 |
215 |
216 |
217 | LEFT ARROW key
218 |
219 |
220 |
221 |
222 | UP ARROW key
223 |
224 |
225 |
226 |
227 | RIGHT ARROW key
228 |
229 |
230 |
231 |
232 | DOWN ARROW key
233 |
234 |
235 |
236 |
237 | SELECT key
238 |
239 |
240 |
241 |
242 | PRINT key
243 |
244 |
245 |
246 |
247 | EXECUTE key
248 |
249 |
250 |
251 |
252 | PRINT SCREEN key
253 |
254 |
255 |
256 |
257 | INS key
258 |
259 |
260 |
261 |
262 | DEL key
263 |
264 |
265 |
266 |
267 | HELP key
268 |
269 |
270 |
271 |
272 | 0 key
273 |
274 |
275 |
276 |
277 | 1 key
278 |
279 |
280 |
281 |
282 | 2 key
283 |
284 |
285 |
286 |
287 | 3 key
288 |
289 |
290 |
291 |
292 | 4 key
293 |
294 |
295 |
296 |
297 | 5 key
298 |
299 |
300 |
301 |
302 | 6 key
303 |
304 |
305 |
306 |
307 | 7 key
308 |
309 |
310 |
311 |
312 | 8 key
313 |
314 |
315 |
316 |
317 | 9 key
318 |
319 |
320 |
321 |
322 | A key
323 |
324 |
325 |
326 |
327 | B key
328 |
329 |
330 |
331 |
332 | C key
333 |
334 |
335 |
336 |
337 | D key
338 |
339 |
340 |
341 |
342 | E key
343 |
344 |
345 |
346 |
347 | F key
348 |
349 |
350 |
351 |
352 | G key
353 |
354 |
355 |
356 |
357 | H key
358 |
359 |
360 |
361 |
362 | I key
363 |
364 |
365 |
366 |
367 | J key
368 |
369 |
370 |
371 |
372 | K key
373 |
374 |
375 |
376 |
377 | L key
378 |
379 |
380 |
381 |
382 | M key
383 |
384 |
385 |
386 |
387 | N key
388 |
389 |
390 |
391 |
392 | O key
393 |
394 |
395 |
396 |
397 | P key
398 |
399 |
400 |
401 |
402 | Q key
403 |
404 |
405 |
406 |
407 | R key
408 |
409 |
410 |
411 |
412 | S key
413 |
414 |
415 |
416 |
417 | T key
418 |
419 |
420 |
421 |
422 | U key
423 |
424 |
425 |
426 |
427 | V key
428 |
429 |
430 |
431 |
432 | W key
433 |
434 |
435 |
436 |
437 | X key
438 |
439 |
440 |
441 |
442 | Y key
443 |
444 |
445 |
446 |
447 | Z key
448 |
449 |
450 |
451 |
452 | Left Windows key (Microsoft Natural keyboard)
453 |
454 |
455 |
456 |
457 | Right Windows key (Natural keyboard)
458 |
459 |
460 |
461 |
462 | Applications key (Natural keyboard)
463 |
464 |
465 |
466 |
467 | Computer Sleep key
468 |
469 |
470 |
471 |
472 | Numeric keypad 0 key
473 |
474 |
475 |
476 |
477 | Numeric keypad 1 key
478 |
479 |
480 |
481 |
482 | Numeric keypad 2 key
483 |
484 |
485 |
486 |
487 | Numeric keypad 3 key
488 |
489 |
490 |
491 |
492 | Numeric keypad 4 key
493 |
494 |
495 |
496 |
497 | Numeric keypad 5 key
498 |
499 |
500 |
501 |
502 | Numeric keypad 6 key
503 |
504 |
505 |
506 |
507 | Numeric keypad 7 key
508 |
509 |
510 |
511 |
512 | Numeric keypad 8 key
513 |
514 |
515 |
516 |
517 | Numeric keypad 9 key
518 |
519 |
520 |
521 |
522 | Multiply key
523 |
524 |
525 |
526 |
527 | Add key
528 |
529 |
530 |
531 |
532 | Separator key
533 |
534 |
535 |
536 |
537 | Subtract key
538 |
539 |
540 |
541 |
542 | Decimal key
543 |
544 |
545 |
546 |
547 | Divide key
548 |
549 |
550 |
551 |
552 | F1 key
553 |
554 |
555 |
556 |
557 | F2 key
558 |
559 |
560 |
561 |
562 | F3 key
563 |
564 |
565 |
566 |
567 | F4 key
568 |
569 |
570 |
571 |
572 | F5 key
573 |
574 |
575 |
576 |
577 | F6 key
578 |
579 |
580 |
581 |
582 | F7 key
583 |
584 |
585 |
586 |
587 | F8 key
588 |
589 |
590 |
591 |
592 | F9 key
593 |
594 |
595 |
596 |
597 | F10 key
598 |
599 |
600 |
601 |
602 | F11 key
603 |
604 |
605 |
606 |
607 | F12 key
608 |
609 |
610 |
611 |
612 | F13 key
613 |
614 |
615 |
616 |
617 | F14 key
618 |
619 |
620 |
621 |
622 | F15 key
623 |
624 |
625 |
626 |
627 | F16 key
628 |
629 |
630 |
631 |
632 | F17 key
633 |
634 |
635 |
636 |
637 | F18 key
638 |
639 |
640 |
641 |
642 | F19 key
643 |
644 |
645 |
646 |
647 | F20 key
648 |
649 |
650 |
651 |
652 | F21 key
653 |
654 |
655 |
656 |
657 | F22 key
658 |
659 |
660 |
661 |
662 | F23 key
663 |
664 |
665 |
666 |
667 | F24 key
668 |
669 |
670 |
671 |
672 | NUM LOCK key
673 |
674 |
675 |
676 |
677 | SCROLL LOCK key
678 |
679 |
680 |
681 |
682 | Left SHIFT key - Used only as parameters to GetAsyncKeyState() and GetKeyState()
683 |
684 |
685 |
686 |
687 | Right SHIFT key - Used only as parameters to GetAsyncKeyState() and GetKeyState()
688 |
689 |
690 |
691 |
692 | Left CONTROL key - Used only as parameters to GetAsyncKeyState() and GetKeyState()
693 |
694 |
695 |
696 |
697 | Right CONTROL key - Used only as parameters to GetAsyncKeyState() and GetKeyState()
698 |
699 |
700 |
701 |
702 | Left MENU key - Used only as parameters to GetAsyncKeyState() and GetKeyState()
703 |
704 |
705 |
706 |
707 | Right MENU key - Used only as parameters to GetAsyncKeyState() and GetKeyState()
708 |
709 |
710 |
711 |
712 | Windows 2000/XP: Browser Back key
713 |
714 |
715 |
716 |
717 | Windows 2000/XP: Browser Forward key
718 |
719 |
720 |
721 |
722 | Windows 2000/XP: Browser Refresh key
723 |
724 |
725 |
726 |
727 | Windows 2000/XP: Browser Stop key
728 |
729 |
730 |
731 |
732 | Windows 2000/XP: Browser Search key
733 |
734 |
735 |
736 |
737 | Windows 2000/XP: Browser Favorites key
738 |
739 |
740 |
741 |
742 | Windows 2000/XP: Browser Start and Home key
743 |
744 |
745 |
746 |
747 | Windows 2000/XP: Volume Mute key
748 |
749 |
750 |
751 |
752 | Windows 2000/XP: Volume Down key
753 |
754 |
755 |
756 |
757 | Windows 2000/XP: Volume Up key
758 |
759 |
760 |
761 |
762 | Windows 2000/XP: Next Track key
763 |
764 |
765 |
766 |
767 | Windows 2000/XP: Previous Track key
768 |
769 |
770 |
771 |
772 | Windows 2000/XP: Stop Media key
773 |
774 |
775 |
776 |
777 | Windows 2000/XP: Play/Pause Media key
778 |
779 |
780 |
781 |
782 | Windows 2000/XP: Start Mail key
783 |
784 |
785 |
786 |
787 | Windows 2000/XP: Select Media key
788 |
789 |
790 |
791 |
792 | Windows 2000/XP: Start Application 1 key
793 |
794 |
795 |
796 |
797 | Windows 2000/XP: Start Application 2 key
798 |
799 |
800 |
801 |
802 | Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ';:' key
803 |
804 |
805 |
806 |
807 | Windows 2000/XP: For any country/region, the '+' key
808 |
809 |
810 |
811 |
812 | Windows 2000/XP: For any country/region, the ',' key
813 |
814 |
815 |
816 |
817 | Windows 2000/XP: For any country/region, the '-' key
818 |
819 |
820 |
821 |
822 | Windows 2000/XP: For any country/region, the '.' key
823 |
824 |
825 |
826 |
827 | Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '/?' key
828 |
829 |
830 |
831 |
832 | Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '`~' key
833 |
834 |
835 |
836 |
837 | Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '[{' key
838 |
839 |
840 |
841 |
842 | Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '\|' key
843 |
844 |
845 |
846 |
847 | Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ']}' key
848 |
849 |
850 |
851 |
852 | Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the 'single-quote/double-quote' key
853 |
854 |
855 |
856 |
857 | Used for miscellaneous characters; it can vary by keyboard.
858 |
859 |
860 |
861 |
862 | Windows 2000/XP: Either the angle bracket key or the backslash key on the RT 102-key keyboard
863 |
864 |
865 |
866 |
867 | Windows 95/98/Me, Windows NT 4.0, Windows 2000/XP: IME PROCESS key
868 |
869 |
870 |
871 |
872 | Windows 2000/XP: Used to pass Unicode characters as if they were keystrokes. The PACKET key is the low word of a 32-bit Virtual Key value used for non-keyboard input methods. For more information, see Remark in KEYBDINPUT, SendInput, WM_KEYDOWN, and WM_KEYUP
873 |
874 |
875 |
876 |
877 | Attn key
878 |
879 |
880 |
881 |
882 | CrSel key
883 |
884 |
885 |
886 |
887 | ExSel key
888 |
889 |
890 |
891 |
892 | Erase EOF key
893 |
894 |
895 |
896 |
897 | Play key
898 |
899 |
900 |
901 |
902 | Zoom key
903 |
904 |
905 |
906 |
907 | Reserved
908 |
909 |
910 |
911 |
912 | PA1 key
913 |
914 |
915 |
916 |
917 | Clear key
918 |
919 |
920 |
921 |
922 | Specifies various aspects of a keystroke. This member can be certain combinations of the following values.
923 |
924 |
925 |
926 |
927 | KEYEVENTF_EXTENDEDKEY = 0x0001 (If specified, the scan code was preceded by a prefix byte that has the value 0xE0 (224).)
928 |
929 |
930 |
931 |
932 | KEYEVENTF_KEYUP = 0x0002 (If specified, the key is being released. If not specified, the key is being pressed.)
933 |
934 |
935 |
936 |
937 | KEYEVENTF_UNICODE = 0x0004 (If specified, wScan identifies the key and wVk is ignored.)
938 |
939 |
940 |
941 |
942 | KEYEVENTF_SCANCODE = 0x0008 (Windows 2000/XP: If specified, the system synthesizes a VK_PACKET keystroke. The wVk parameter must be zero. This flag can only be combined with the KEYEVENTF_KEYUP flag. For more information, see the Remarks section.)
943 |
944 |
945 |
946 |
947 | The KEYBDINPUT structure contains information about a simulated keyboard event. (see: http://msdn.microsoft.com/en-us/library/ms646271(VS.85).aspx)
948 | Declared in Winuser.h, include Windows.h
949 |
950 |
951 | Windows 2000/XP: INPUT_KEYBOARD supports nonkeyboard-input methodssuch as handwriting recognition or voice recognitionas if it were text input by using the KEYEVENTF_UNICODE flag. If KEYEVENTF_UNICODE is specified, SendInput sends a WM_KEYDOWN or WM_KEYUP message to the foreground thread's message queue with wParam equal to VK_PACKET. Once GetMessage or PeekMessage obtains this message, passing the message to TranslateMessage posts a WM_CHAR message with the Unicode character originally specified by wScan. This Unicode character will automatically be converted to the appropriate ANSI value if it is posted to an ANSI window.
952 | Windows 2000/XP: Set the KEYEVENTF_SCANCODE flag to define keyboard input in terms of the scan code. This is useful to simulate a physical keystroke regardless of which keyboard is currently being used. The virtual key value of a key may alter depending on the current keyboard layout or what other keys were pressed, but the scan code will always be the same.
953 |
954 |
955 |
956 |
957 | Specifies a virtual-key code. The code must be a value in the range 1 to 254. The Winuser.h header file provides macro definitions (VK_*) for each value. If the dwFlags member specifies KEYEVENTF_UNICODE, wVk must be 0.
958 |
959 |
960 |
961 |
962 | Specifies a hardware scan code for the key. If dwFlags specifies KEYEVENTF_UNICODE, wScan specifies a Unicode character which is to be sent to the foreground application.
963 |
964 |
965 |
966 |
967 | Specifies various aspects of a keystroke. This member can be certain combinations of the following values.
968 | KEYEVENTF_EXTENDEDKEY - If specified, the scan code was preceded by a prefix byte that has the value 0xE0 (224).
969 | KEYEVENTF_KEYUP - If specified, the key is being released. If not specified, the key is being pressed.
970 | KEYEVENTF_SCANCODE - If specified, wScan identifies the key and wVk is ignored.
971 | KEYEVENTF_UNICODE - Windows 2000/XP: If specified, the system synthesizes a VK_PACKET keystroke. The wVk parameter must be zero. This flag can only be combined with the KEYEVENTF_KEYUP flag. For more information, see the Remarks section.
972 |
973 |
974 |
975 |
976 | Time stamp for the event, in milliseconds. If this parameter is zero, the system will provide its own time stamp.
977 |
978 |
979 |
980 |
981 | Specifies an additional value associated with the keystroke. Use the GetMessageExtraInfo function to obtain this information.
982 |
983 |
984 |
985 |
986 | Specifies the type of the input event. This member can be one of the following values.
987 |
988 |
989 |
990 |
991 | INPUT_MOUSE = 0x00 (The event is a mouse event. Use the mi structure of the union.)
992 |
993 |
994 |
995 |
996 | INPUT_KEYBOARD = 0x01 (The event is a keyboard event. Use the ki structure of the union.)
997 |
998 |
999 |
1000 |
1001 | INPUT_HARDWARE = 0x02 (Windows 95/98/Me: The event is from input hardware other than a keyboard or mouse. Use the hi structure of the union.)
1002 |
1003 |
1004 |
1005 |
1006 | Provides a useful wrapper around the User32 SendInput and related native Windows functions.
1007 |
1008 |
1009 |
1010 |
1011 | The SendInput function synthesizes keystrokes, mouse motions, and button clicks.
1012 |
1013 | Number of structures in the Inputs array.
1014 | Pointer to an array of INPUT structures. Each structure represents an event to be inserted into the keyboard or mouse input stream.
1015 | Specifies the size, in bytes, of an INPUT structure. If cbSize is not the size of an INPUT structure, the function fails.
1016 | The function returns the number of events that it successfully inserted into the keyboard or mouse input stream. If the function returns zero, the input was already blocked by another thread. To get extended error information, call GetLastError.Microsoft Windows Vista. This function fails when it is blocked by User Interface Privilege Isolation (UIPI). Note that neither GetLastError nor the return value will indicate the failure was caused by UIPI blocking.
1017 |
1018 | Microsoft Windows Vista. This function is subject to UIPI. Applications are permitted to inject input only into applications that are at an equal or lesser integrity level.
1019 | The SendInput function inserts the events in the INPUT structures serially into the keyboard or mouse input stream. These events are not interspersed with other keyboard or mouse input events inserted either by the user (with the keyboard or mouse) or by calls to keybd_event, mouse_event, or other calls to SendInput.
1020 | This function does not reset the keyboard's current state. Any keys that are already pressed when the function is called might interfere with the events that this function generates. To avoid this problem, check the keyboard's state with the GetAsyncKeyState function and correct as necessary.
1021 |
1022 |
1023 |
1024 |
1025 | The GetAsyncKeyState function determines whether a key is up or down at the time the function is called, and whether the key was pressed after a previous call to GetAsyncKeyState. (See: http://msdn.microsoft.com/en-us/library/ms646293(VS.85).aspx)
1026 |
1027 | Specifies one of 256 possible virtual-key codes. For more information, see Virtual Key Codes. Windows NT/2000/XP: You can use left- and right-distinguishing constants to specify certain keys. See the Remarks section for further information.
1028 |
1029 | If the function succeeds, the return value specifies whether the key was pressed since the last call to GetAsyncKeyState, and whether the key is currently up or down. If the most significant bit is set, the key is down, and if the least significant bit is set, the key was pressed after the previous call to GetAsyncKeyState. However, you should not rely on this last behavior; for more information, see the Remarks.
1030 |
1031 | Windows NT/2000/XP: The return value is zero for the following cases:
1032 | - The current desktop is not the active desktop
1033 | - The foreground thread belongs to another process and the desktop does not allow the hook or the journal record.
1034 |
1035 | Windows 95/98/Me: The return value is the global asynchronous key state for each virtual key. The system does not check which thread has the keyboard focus.
1036 |
1037 | Windows 95/98/Me: Windows 95 does not support the left- and right-distinguishing constants. If you call GetAsyncKeyState with these constants, the return value is zero.
1038 |
1039 |
1040 | The GetAsyncKeyState function works with mouse buttons. However, it checks on the state of the physical mouse buttons, not on the logical mouse buttons that the physical buttons are mapped to. For example, the call GetAsyncKeyState(VK_LBUTTON) always returns the state of the left physical mouse button, regardless of whether it is mapped to the left or right logical mouse button. You can determine the system's current mapping of physical mouse buttons to logical mouse buttons by calling
1041 | Copy CodeGetSystemMetrics(SM_SWAPBUTTON) which returns TRUE if the mouse buttons have been swapped.
1042 |
1043 | Although the least significant bit of the return value indicates whether the key has been pressed since the last query, due to the pre-emptive multitasking nature of Windows, another application can call GetAsyncKeyState and receive the "recently pressed" bit instead of your application. The behavior of the least significant bit of the return value is retained strictly for compatibility with 16-bit Windows applications (which are non-preemptive) and should not be relied upon.
1044 |
1045 | You can use the virtual-key code constants VK_SHIFT, VK_CONTROL, and VK_MENU as values for the vKey parameter. This gives the state of the SHIFT, CTRL, or ALT keys without distinguishing between left and right.
1046 |
1047 | Windows NT/2000/XP: You can use the following virtual-key code constants as values for vKey to distinguish between the left and right instances of those keys.
1048 |
1049 | Code Meaning
1050 | VK_LSHIFT Left-shift key.
1051 | VK_RSHIFT Right-shift key.
1052 | VK_LCONTROL Left-control key.
1053 | VK_RCONTROL Right-control key.
1054 | VK_LMENU Left-menu key.
1055 | VK_RMENU Right-menu key.
1056 |
1057 | These left- and right-distinguishing constants are only available when you call the GetKeyboardState, SetKeyboardState, GetAsyncKeyState, GetKeyState, and MapVirtualKey functions.
1058 |
1059 |
1060 |
1061 |
1062 | The GetKeyState function retrieves the status of the specified virtual key. The status specifies whether the key is up, down, or toggled (on, off alternating each time the key is pressed). (See: http://msdn.microsoft.com/en-us/library/ms646301(VS.85).aspx)
1063 |
1064 |
1065 | Specifies a virtual key. If the desired virtual key is a letter or digit (A through Z, a through z, or 0 through 9), nVirtKey must be set to the ASCII value of that character. For other keys, it must be a virtual-key code.
1066 | If a non-English keyboard layout is used, virtual keys with values in the range ASCII A through Z and 0 through 9 are used to specify most of the character keys. For example, for the German keyboard layout, the virtual key of value ASCII O (0x4F) refers to the "o" key, whereas VK_OEM_1 refers to the "o with umlaut" key.
1067 |
1068 |
1069 | The return value specifies the status of the specified virtual key, as follows:
1070 | If the high-order bit is 1, the key is down; otherwise, it is up.
1071 | If the low-order bit is 1, the key is toggled. A key, such as the CAPS LOCK key, is toggled if it is turned on. The key is off and untoggled if the low-order bit is 0. A toggle key's indicator light (if any) on the keyboard will be on when the key is toggled, and off when the key is untoggled.
1072 |
1073 |
1074 | The key status returned from this function changes as a thread reads key messages from its message queue. The status does not reflect the interrupt-level state associated with the hardware. Use the GetAsyncKeyState function to retrieve that information.
1075 | An application calls GetKeyState in response to a keyboard-input message. This function retrieves the state of the key when the input message was generated.
1076 | To retrieve state information for all the virtual keys, use the GetKeyboardState function.
1077 | An application can use the virtual-key code constants VK_SHIFT, VK_CONTROL, and VK_MENU as values for the nVirtKey parameter. This gives the status of the SHIFT, CTRL, or ALT keys without distinguishing between left and right. An application can also use the following virtual-key code constants as values for nVirtKey to distinguish between the left and right instances of those keys.
1078 | VK_LSHIFT
1079 | VK_RSHIFT
1080 | VK_LCONTROL
1081 | VK_RCONTROL
1082 | VK_LMENU
1083 | VK_RMENU
1084 |
1085 | These left- and right-distinguishing constants are available to an application only through the GetKeyboardState, SetKeyboardState, GetAsyncKeyState, GetKeyState, and MapVirtualKey functions.
1086 |
1087 |
1088 |
1089 |
1090 | The GetMessageExtraInfo function retrieves the extra message information for the current thread. Extra message information is an application- or driver-defined value associated with the current thread's message queue.
1091 |
1092 |
1093 | To set a thread's extra message information, use the SetMessageExtraInfo function.
1094 |
1095 |
1096 |
1097 | Determines whether a key is up or down at the time the function is called by calling the GetAsyncKeyState function. (See: http://msdn.microsoft.com/en-us/library/ms646293(VS.85).aspx)
1098 |
1099 | The key code.
1100 |
1101 | true if the key is down; otherwise, false.
1102 |
1103 |
1104 | The GetAsyncKeyState function works with mouse buttons. However, it checks on the state of the physical mouse buttons, not on the logical mouse buttons that the physical buttons are mapped to. For example, the call GetAsyncKeyState(VK_LBUTTON) always returns the state of the left physical mouse button, regardless of whether it is mapped to the left or right logical mouse button. You can determine the system's current mapping of physical mouse buttons to logical mouse buttons by calling
1105 | Copy CodeGetSystemMetrics(SM_SWAPBUTTON) which returns TRUE if the mouse buttons have been swapped.
1106 |
1107 | Although the least significant bit of the return value indicates whether the key has been pressed since the last query, due to the pre-emptive multitasking nature of Windows, another application can call GetAsyncKeyState and receive the "recently pressed" bit instead of your application. The behavior of the least significant bit of the return value is retained strictly for compatibility with 16-bit Windows applications (which are non-preemptive) and should not be relied upon.
1108 |
1109 | You can use the virtual-key code constants VK_SHIFT, VK_CONTROL, and VK_MENU as values for the vKey parameter. This gives the state of the SHIFT, CTRL, or ALT keys without distinguishing between left and right.
1110 |
1111 | Windows NT/2000/XP: You can use the following virtual-key code constants as values for vKey to distinguish between the left and right instances of those keys.
1112 |
1113 | Code Meaning
1114 | VK_LSHIFT Left-shift key.
1115 | VK_RSHIFT Right-shift key.
1116 | VK_LCONTROL Left-control key.
1117 | VK_RCONTROL Right-control key.
1118 | VK_LMENU Left-menu key.
1119 | VK_RMENU Right-menu key.
1120 |
1121 | These left- and right-distinguishing constants are only available when you call the GetKeyboardState, SetKeyboardState, GetAsyncKeyState, GetKeyState, and MapVirtualKey functions.
1122 |
1123 |
1124 |
1125 |
1126 | Determines whether the specified key is up or down by calling the GetKeyState function. (See: http://msdn.microsoft.com/en-us/library/ms646301(VS.85).aspx)
1127 |
1128 | The for the key.
1129 |
1130 | true if the key is down; otherwise, false.
1131 |
1132 |
1133 | The key status returned from this function changes as a thread reads key messages from its message queue. The status does not reflect the interrupt-level state associated with the hardware. Use the GetAsyncKeyState function to retrieve that information.
1134 | An application calls GetKeyState in response to a keyboard-input message. This function retrieves the state of the key when the input message was generated.
1135 | To retrieve state information for all the virtual keys, use the GetKeyboardState function.
1136 | An application can use the virtual-key code constants VK_SHIFT, VK_CONTROL, and VK_MENU as values for the nVirtKey parameter. This gives the status of the SHIFT, CTRL, or ALT keys without distinguishing between left and right. An application can also use the following virtual-key code constants as values for nVirtKey to distinguish between the left and right instances of those keys.
1137 | VK_LSHIFT
1138 | VK_RSHIFT
1139 | VK_LCONTROL
1140 | VK_RCONTROL
1141 | VK_LMENU
1142 | VK_RMENU
1143 |
1144 | These left- and right-distinguishing constants are available to an application only through the GetKeyboardState, SetKeyboardState, GetAsyncKeyState, GetKeyState, and MapVirtualKey functions.
1145 |
1146 |
1147 |
1148 |
1149 | Determines whether the toggling key is toggled on (in-effect) or not by calling the GetKeyState function. (See: http://msdn.microsoft.com/en-us/library/ms646301(VS.85).aspx)
1150 |
1151 | The for the key.
1152 |
1153 | true if the toggling key is toggled on (in-effect); otherwise, false.
1154 |
1155 |
1156 | The key status returned from this function changes as a thread reads key messages from its message queue. The status does not reflect the interrupt-level state associated with the hardware. Use the GetAsyncKeyState function to retrieve that information.
1157 | An application calls GetKeyState in response to a keyboard-input message. This function retrieves the state of the key when the input message was generated.
1158 | To retrieve state information for all the virtual keys, use the GetKeyboardState function.
1159 | An application can use the virtual-key code constants VK_SHIFT, VK_CONTROL, and VK_MENU as values for the nVirtKey parameter. This gives the status of the SHIFT, CTRL, or ALT keys without distinguishing between left and right. An application can also use the following virtual-key code constants as values for nVirtKey to distinguish between the left and right instances of those keys.
1160 | VK_LSHIFT
1161 | VK_RSHIFT
1162 | VK_LCONTROL
1163 | VK_RCONTROL
1164 | VK_LMENU
1165 | VK_RMENU
1166 |
1167 | These left- and right-distinguishing constants are available to an application only through the GetKeyboardState, SetKeyboardState, GetAsyncKeyState, GetKeyState, and MapVirtualKey functions.
1168 |
1169 |
1170 |
1171 |
1172 | Calls the Win32 SendInput method to simulate a Key DOWN.
1173 |
1174 | The VirtualKeyCode to press
1175 |
1176 |
1177 |
1178 | Calls the Win32 SendInput method to simulate a Key UP.
1179 |
1180 | The VirtualKeyCode to lift up
1181 |
1182 |
1183 |
1184 | Calls the Win32 SendInput method with a KeyDown and KeyUp message in the same input sequence in order to simulate a Key PRESS.
1185 |
1186 | The VirtualKeyCode to press
1187 |
1188 |
1189 |
1190 | Calls the Win32 SendInput method with a stream of KeyDown and KeyUp messages in order to simulate uninterrupted text entry via the keyboard.
1191 |
1192 | The text to be simulated.
1193 |
1194 |
1195 |
1196 | Performs a simple modified keystroke like CTRL-C where CTRL is the modifierKey and C is the key.
1197 | The flow is Modifier KEYDOWN, Key PRESS, Modifier KEYUP.
1198 |
1199 | The modifier key
1200 | The key to simulate
1201 |
1202 |
1203 |
1204 | Performs a modified keystroke where there are multiple modifiers and one key like CTRL-ALT-C where CTRL and ALT are the modifierKeys and C is the key.
1205 | The flow is Modifiers KEYDOWN in order, Key PRESS, Modifiers KEYUP in reverse order.
1206 |
1207 | The list of modifier keys
1208 | The key to simulate
1209 |
1210 |
1211 |
1212 | Performs a modified keystroke where there is one modifier and multiple keys like CTRL-K-C where CTRL is the modifierKey and K and C are the keys.
1213 | The flow is Modifier KEYDOWN, Keys PRESS in order, Modifier KEYUP.
1214 |
1215 | The modifier key
1216 | The list of keys to simulate
1217 |
1218 |
1219 |
1220 | Performs a modified keystroke where there are multiple modifiers and multiple keys like CTRL-ALT-K-C where CTRL and ALT are the modifierKeys and K and C are the keys.
1221 | The flow is Modifiers KEYDOWN in order, Keys PRESS in order, Modifiers KEYUP in reverse order.
1222 |
1223 | The list of modifier keys
1224 | The list of keys to simulate
1225 |
1226 |
1227 |
1228 | The MOUSEINPUT structure contains information about a simulated mouse event. (see: http://msdn.microsoft.com/en-us/library/ms646273(VS.85).aspx)
1229 | Declared in Winuser.h, include Windows.h
1230 |
1231 |
1232 | If the mouse has moved, indicated by MOUSEEVENTF_MOVE, dxand dy specify information about that movement. The information is specified as absolute or relative integer values.
1233 | If MOUSEEVENTF_ABSOLUTE value is specified, dx and dy contain normalized absolute coordinates between 0 and 65,535. The event procedure maps these coordinates onto the display surface. Coordinate (0,0) maps onto the upper-left corner of the display surface; coordinate (65535,65535) maps onto the lower-right corner. In a multimonitor system, the coordinates map to the primary monitor.
1234 | Windows 2000/XP: If MOUSEEVENTF_VIRTUALDESK is specified, the coordinates map to the entire virtual desktop.
1235 | If the MOUSEEVENTF_ABSOLUTE value is not specified, dxand dy specify movement relative to the previous mouse event (the last reported position). Positive values mean the mouse moved right (or down); negative values mean the mouse moved left (or up).
1236 | Relative mouse motion is subject to the effects of the mouse speed and the two-mouse threshold values. A user sets these three values with the Pointer Speed slider of the Control Panel's Mouse Properties sheet. You can obtain and set these values using the SystemParametersInfo function.
1237 | The system applies two tests to the specified relative mouse movement. If the specified distance along either the x or y axis is greater than the first mouse threshold value, and the mouse speed is not zero, the system doubles the distance. If the specified distance along either the x or y axis is greater than the second mouse threshold value, and the mouse speed is equal to two, the system doubles the distance that resulted from applying the first threshold test. It is thus possible for the system to multiply specified relative mouse movement along the x or y axis by up to four times.
1238 |
1239 |
1240 |
1241 |
1242 | Specifies the absolute position of the mouse, or the amount of motion since the last mouse event was generated, depending on the value of the dwFlags member. Absolute data is specified as the x coordinate of the mouse; relative data is specified as the number of pixels moved.
1243 |
1244 |
1245 |
1246 |
1247 | Specifies the absolute position of the mouse, or the amount of motion since the last mouse event was generated, depending on the value of the dwFlags member. Absolute data is specified as the y coordinate of the mouse; relative data is specified as the number of pixels moved.
1248 |
1249 |
1250 |
1251 |
1252 | If dwFlags contains MOUSEEVENTF_WHEEL, then mouseData specifies the amount of wheel movement. A positive value indicates that the wheel was rotated forward, away from the user; a negative value indicates that the wheel was rotated backward, toward the user. One wheel click is defined as WHEEL_DELTA, which is 120.
1253 | Windows Vista: If dwFlags contains MOUSEEVENTF_HWHEEL, then dwData specifies the amount of wheel movement. A positive value indicates that the wheel was rotated to the right; a negative value indicates that the wheel was rotated to the left. One wheel click is defined as WHEEL_DELTA, which is 120.
1254 | Windows 2000/XP: IfdwFlags does not contain MOUSEEVENTF_WHEEL, MOUSEEVENTF_XDOWN, or MOUSEEVENTF_XUP, then mouseData should be zero.
1255 | If dwFlags contains MOUSEEVENTF_XDOWN or MOUSEEVENTF_XUP, then mouseData specifies which X buttons were pressed or released. This value may be any combination of the following flags.
1256 |
1257 |
1258 |
1259 |
1260 | A set of bit flags that specify various aspects of mouse motion and button clicks. The bits in this member can be any reasonable combination of the following values.
1261 | The bit flags that specify mouse button status are set to indicate changes in status, not ongoing conditions. For example, if the left mouse button is pressed and held down, MOUSEEVENTF_LEFTDOWN is set when the left button is first pressed, but not for subsequent motions. Similarly, MOUSEEVENTF_LEFTUP is set only when the button is first released.
1262 | You cannot specify both the MOUSEEVENTF_WHEEL flag and either MOUSEEVENTF_XDOWN or MOUSEEVENTF_XUP flags simultaneously in the dwFlags parameter, because they both require use of the mouseData field.
1263 |
1264 |
1265 |
1266 |
1267 | Time stamp for the event, in milliseconds. If this parameter is 0, the system will provide its own time stamp.
1268 |
1269 |
1270 |
1271 |
1272 | Specifies an additional value associated with the mouse event. An application calls GetMessageExtraInfo to obtain this extra information.
1273 |
1274 |
1275 |
1276 |
1277 | The set of MouseFlags for use in the Flags property of the structure. (See: http://msdn.microsoft.com/en-us/library/ms646273(VS.85).aspx)
1278 |
1279 |
1280 |
1281 |
1282 | Specifies that movement occurred.
1283 |
1284 |
1285 |
1286 |
1287 | Specifies that the left button was pressed.
1288 |
1289 |
1290 |
1291 |
1292 | Specifies that the left button was released.
1293 |
1294 |
1295 |
1296 |
1297 | Specifies that the right button was pressed.
1298 |
1299 |
1300 |
1301 |
1302 | Specifies that the right button was released.
1303 |
1304 |
1305 |
1306 |
1307 | Specifies that the middle button was pressed.
1308 |
1309 |
1310 |
1311 |
1312 | Specifies that the middle button was released.
1313 |
1314 |
1315 |
1316 |
1317 | Windows 2000/XP: Specifies that an X button was pressed.
1318 |
1319 |
1320 |
1321 |
1322 | Windows 2000/XP: Specifies that an X button was released.
1323 |
1324 |
1325 |
1326 |
1327 | Windows NT/2000/XP: Specifies that the wheel was moved, if the mouse has a wheel. The amount of movement is specified in mouseData.
1328 |
1329 |
1330 |
1331 |
1332 | Windows 2000/XP: Maps coordinates to the entire desktop. Must be used with MOUSEEVENTF_ABSOLUTE.
1333 |
1334 |
1335 |
1336 |
1337 | Specifies that the dx and dy members contain normalized absolute coordinates. If the flag is not set, dxand dy contain relative data (the change in position since the last reported position). This flag can be set, or not set, regardless of what kind of mouse or other pointing device, if any, is connected to the system. For further information about relative mouse motion, see the following Remarks section.
1338 |
1339 |
1340 |
1341 |
1342 | The HARDWAREINPUT structure contains information about a simulated message generated by an input device other than a keyboard or mouse. (see: http://msdn.microsoft.com/en-us/library/ms646269(VS.85).aspx)
1343 | Declared in Winuser.h, include Windows.h
1344 |
1345 |
1346 |
1347 |
1348 | Value specifying the message generated by the input hardware.
1349 |
1350 |
1351 |
1352 |
1353 | Specifies the low-order word of the lParam parameter for uMsg.
1354 |
1355 |
1356 |
1357 |
1358 | Specifies the high-order word of the lParam parameter for uMsg.
1359 |
1360 |
1361 |
1362 |
1363 |
--------------------------------------------------------------------------------
/libs/InputSimulator.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bediveren/RemoteControllerCsharp/adaa84acf46e4d736b3731f08a4b612a9c51ec0f/libs/InputSimulator.dll
--------------------------------------------------------------------------------
/libs/InputSimulator.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bediveren/RemoteControllerCsharp/adaa84acf46e4d736b3731f08a4b612a9c51ec0f/libs/InputSimulator.pdb
--------------------------------------------------------------------------------
/obj/Debug/DesignTimeResolveAssemblyReferences.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bediveren/RemoteControllerCsharp/adaa84acf46e4d736b3731f08a4b612a9c51ec0f/obj/Debug/DesignTimeResolveAssemblyReferences.cache
--------------------------------------------------------------------------------
/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bediveren/RemoteControllerCsharp/adaa84acf46e4d736b3731f08a4b612a9c51ec0f/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
--------------------------------------------------------------------------------
/obj/Debug/Interop.MSTSCLib.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bediveren/RemoteControllerCsharp/adaa84acf46e4d736b3731f08a4b612a9c51ec0f/obj/Debug/Interop.MSTSCLib.dll
--------------------------------------------------------------------------------
/obj/Debug/RemoteControl.HostForm.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bediveren/RemoteControllerCsharp/adaa84acf46e4d736b3731f08a4b612a9c51ec0f/obj/Debug/RemoteControl.HostForm.resources
--------------------------------------------------------------------------------
/obj/Debug/RemoteControl.Properties.Resources.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bediveren/RemoteControllerCsharp/adaa84acf46e4d736b3731f08a4b612a9c51ec0f/obj/Debug/RemoteControl.Properties.Resources.resources
--------------------------------------------------------------------------------
/obj/Debug/RemoteControl.SetupForm.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bediveren/RemoteControllerCsharp/adaa84acf46e4d736b3731f08a4b612a9c51ec0f/obj/Debug/RemoteControl.SetupForm.resources
--------------------------------------------------------------------------------
/obj/Debug/RemoteControl.ViewerForm.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bediveren/RemoteControllerCsharp/adaa84acf46e4d736b3731f08a4b612a9c51ec0f/obj/Debug/RemoteControl.ViewerForm.resources
--------------------------------------------------------------------------------
/obj/Debug/RemoteControl.csproj.FileListAbsolute.txt:
--------------------------------------------------------------------------------
1 | C:\Programming\C#\Studies\RemoteControl\bin\Debug\RemoteControl.exe.config
2 | C:\Programming\C#\Studies\RemoteControl\obj\Debug\RemoteControl.Properties.Resources.resources
3 | C:\Programming\C#\Studies\RemoteControl\obj\Debug\RemoteControl.csproj.GenerateResource.Cache
4 | C:\Programming\C#\Studies\RemoteControl\bin\Debug\RemoteControl.exe
5 | C:\Programming\C#\Studies\RemoteControl\bin\Debug\RemoteControl.pdb
6 | C:\Programming\C#\Studies\RemoteControl\obj\Debug\RemoteControl.exe
7 | C:\Programming\C#\Studies\RemoteControl\obj\Debug\RemoteControl.pdb
8 | C:\Programming\C#\Studies\RemoteControl\obj\Debug\RemoteControl.SetupForm.resources
9 | C:\Programming\C#\Studies\RemoteControl\obj\Debug\RemoteControl.ViewerForm.resources
10 | C:\Programming\C#\Studies\RemoteControl\bin\Debug\System.Net.Http.dll
11 | C:\Programming\C#\Studies\RemoteControl\bin\Debug\System.Net.Http.xml
12 | C:\Programming\C#\Studies\RemoteControl\obj\Debug\RemoteControl.HostForm.resources
13 | C:\Programming\C#\Studies\RemoteControl\bin\Debug\InputSimulator.dll
14 | C:\Programming\C#\Studies\RemoteControl\bin\Debug\InputSimulator.pdb
15 | C:\Programming\C#\Studies\RemoteControl\bin\Debug\InputSimulator.xml
16 | C:\Programming\C#\Studies\RemoteControl\obj\Debug\RemoteControl.csprojResolveAssemblyReference.cache
17 |
--------------------------------------------------------------------------------
/obj/Debug/RemoteControl.csproj.GenerateResource.Cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bediveren/RemoteControllerCsharp/adaa84acf46e4d736b3731f08a4b612a9c51ec0f/obj/Debug/RemoteControl.csproj.GenerateResource.Cache
--------------------------------------------------------------------------------
/obj/Debug/RemoteControl.csproj.ResolveComReference.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bediveren/RemoteControllerCsharp/adaa84acf46e4d736b3731f08a4b612a9c51ec0f/obj/Debug/RemoteControl.csproj.ResolveComReference.cache
--------------------------------------------------------------------------------
/obj/Debug/RemoteControl.csprojResolveAssemblyReference.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bediveren/RemoteControllerCsharp/adaa84acf46e4d736b3731f08a4b612a9c51ec0f/obj/Debug/RemoteControl.csprojResolveAssemblyReference.cache
--------------------------------------------------------------------------------
/obj/Debug/RemoteControl.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bediveren/RemoteControllerCsharp/adaa84acf46e4d736b3731f08a4b612a9c51ec0f/obj/Debug/RemoteControl.exe
--------------------------------------------------------------------------------
/obj/Debug/RemoteControl.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bediveren/RemoteControllerCsharp/adaa84acf46e4d736b3731f08a4b612a9c51ec0f/obj/Debug/RemoteControl.pdb
--------------------------------------------------------------------------------
/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bediveren/RemoteControllerCsharp/adaa84acf46e4d736b3731f08a4b612a9c51ec0f/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll
--------------------------------------------------------------------------------
/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bediveren/RemoteControllerCsharp/adaa84acf46e4d736b3731f08a4b612a9c51ec0f/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
--------------------------------------------------------------------------------
/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bediveren/RemoteControllerCsharp/adaa84acf46e4d736b3731f08a4b612a9c51ec0f/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
--------------------------------------------------------------------------------
/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bediveren/RemoteControllerCsharp/adaa84acf46e4d736b3731f08a4b612a9c51ec0f/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
--------------------------------------------------------------------------------
/obj/Release/RemoteControl.HostForm.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bediveren/RemoteControllerCsharp/adaa84acf46e4d736b3731f08a4b612a9c51ec0f/obj/Release/RemoteControl.HostForm.resources
--------------------------------------------------------------------------------
/obj/Release/RemoteControl.Properties.Resources.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bediveren/RemoteControllerCsharp/adaa84acf46e4d736b3731f08a4b612a9c51ec0f/obj/Release/RemoteControl.Properties.Resources.resources
--------------------------------------------------------------------------------
/obj/Release/RemoteControl.SetupForm.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bediveren/RemoteControllerCsharp/adaa84acf46e4d736b3731f08a4b612a9c51ec0f/obj/Release/RemoteControl.SetupForm.resources
--------------------------------------------------------------------------------
/obj/Release/RemoteControl.ViewerForm.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bediveren/RemoteControllerCsharp/adaa84acf46e4d736b3731f08a4b612a9c51ec0f/obj/Release/RemoteControl.ViewerForm.resources
--------------------------------------------------------------------------------
/obj/Release/RemoteControl.csproj.FileListAbsolute.txt:
--------------------------------------------------------------------------------
1 | C:\Programming\C#\Studies\RemoteControl\bin\Release\RemoteControl.exe.config
2 | C:\Programming\C#\Studies\RemoteControl\bin\Release\RemoteControl.exe
3 | C:\Programming\C#\Studies\RemoteControl\bin\Release\RemoteControl.pdb
4 | C:\Programming\C#\Studies\RemoteControl\obj\Release\RemoteControl.SetupForm.resources
5 | C:\Programming\C#\Studies\RemoteControl\obj\Release\RemoteControl.Properties.Resources.resources
6 | C:\Programming\C#\Studies\RemoteControl\obj\Release\RemoteControl.ViewerForm.resources
7 | C:\Programming\C#\Studies\RemoteControl\obj\Release\RemoteControl.csproj.GenerateResource.Cache
8 | C:\Programming\C#\Studies\RemoteControl\obj\Release\RemoteControl.exe
9 | C:\Programming\C#\Studies\RemoteControl\obj\Release\RemoteControl.pdb
10 | C:\Programming\C#\Studies\RemoteControl\bin\Release\System.Net.Http.dll
11 | C:\Programming\C#\Studies\RemoteControl\bin\Release\System.Net.Http.xml
12 | C:\Programming\C#\Studies\RemoteControl\obj\Release\RemoteControl.HostForm.resources
13 | C:\Programming\C#\Studies\RemoteControl\bin\Release\InputSimulator.dll
14 | C:\Programming\C#\Studies\RemoteControl\bin\Release\InputSimulator.pdb
15 | C:\Programming\C#\Studies\RemoteControl\bin\Release\InputSimulator.xml
16 | C:\Programming\C#\Studies\RemoteControl\obj\Release\RemoteControl.csprojResolveAssemblyReference.cache
17 |
--------------------------------------------------------------------------------
/obj/Release/RemoteControl.csproj.GenerateResource.Cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bediveren/RemoteControllerCsharp/adaa84acf46e4d736b3731f08a4b612a9c51ec0f/obj/Release/RemoteControl.csproj.GenerateResource.Cache
--------------------------------------------------------------------------------
/obj/Release/RemoteControl.csprojResolveAssemblyReference.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bediveren/RemoteControllerCsharp/adaa84acf46e4d736b3731f08a4b612a9c51ec0f/obj/Release/RemoteControl.csprojResolveAssemblyReference.cache
--------------------------------------------------------------------------------
/obj/Release/RemoteControl.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bediveren/RemoteControllerCsharp/adaa84acf46e4d736b3731f08a4b612a9c51ec0f/obj/Release/RemoteControl.exe
--------------------------------------------------------------------------------
/obj/Release/RemoteControl.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bediveren/RemoteControllerCsharp/adaa84acf46e4d736b3731f08a4b612a9c51ec0f/obj/Release/RemoteControl.pdb
--------------------------------------------------------------------------------
/obj/Release/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bediveren/RemoteControllerCsharp/adaa84acf46e4d736b3731f08a4b612a9c51ec0f/obj/Release/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
--------------------------------------------------------------------------------
/obj/Release/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bediveren/RemoteControllerCsharp/adaa84acf46e4d736b3731f08a4b612a9c51ec0f/obj/Release/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
--------------------------------------------------------------------------------
/obj/Release/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bediveren/RemoteControllerCsharp/adaa84acf46e4d736b3731f08a4b612a9c51ec0f/obj/Release/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
--------------------------------------------------------------------------------