diff --git a/Sunfish/Sunfish/Program.cs b/Sunfish/Sunfish/Program.cs index e4eaa11..6ef3bb5 100644 --- a/Sunfish/Sunfish/Program.cs +++ b/Sunfish/Sunfish/Program.cs @@ -8,7 +8,7 @@ { static class Program { - public static string VERSION = "0.9"; + public static string VERSION = "0.9b"; private static Form1 mainform; /// /// Punto de entrada principal para la aplicación. diff --git a/Sunfish/Sunfish/Resources/ShScreen.js b/Sunfish/Sunfish/Resources/ShScreen.js index 5895651..4c0da1a 100644 --- a/Sunfish/Sunfish/Resources/ShScreen.js +++ b/Sunfish/Sunfish/Resources/ShScreen.js @@ -4,7 +4,7 @@ return document.getElementById(name); } var sfifo = []; - var sending=false; + var sending = false; var send = function (code, cmd, important) { if (sending) { if (important) @@ -22,7 +22,7 @@ send(code, null); } xmlhttp.onreadystatechange = function (evt) { - if (xmlhttp.readyState == 4) + if (xmlhttp.readyState == 4) unlock(); } xmlhttp.onerror = function () { @@ -49,11 +49,11 @@ frm.style.display = ""; } img.onmousemove = function (evt) { - send(code, "MV"+evt.offsetX+";"+evt.offsetY,false); + send(code, "MV" + evt.offsetX + ";" + evt.offsetY, false); } img.onmousedown = function (evt) { - var buttons = ["LD","MD","RD"]; - send(code, buttons[evt.button] + evt.offsetX + ";" + evt.offsetY,true); + var buttons = ["LD", "MD", "RD"]; + send(code, buttons[evt.button] + evt.offsetX + ";" + evt.offsetY, true); return false; } img.onmouseup = function (evt) { @@ -62,7 +62,7 @@ return false; } img.onmousewheel = function (evt) { - send(code, "WH" + evt.offsetX + ";" + evt.offsetY + ";" + evt.wheelDelta,false); + send(code, "WH" + evt.offsetX + ";" + evt.offsetY + ";" + evt.wheelDelta, false); return false; } img.onclick = function (evt) { @@ -71,6 +71,17 @@ img.oncontextmenu = function () { return false; } + document.onkeydown = function (evt) { + send(code, "KD" + evt.which, true); + return false; + } + document.onkeyup = function (evt) { + send(code, "KU" + evt.which, true); + return false; + } + document.onkeypress = function (evt) { + return false; + } img.src = "/$screencap?code=" + code; } })(); \ No newline at end of file diff --git a/Sunfish/Sunfish/Sunfish.csproj b/Sunfish/Sunfish/Sunfish.csproj index f06fba5..352b74f 100644 --- a/Sunfish/Sunfish/Sunfish.csproj +++ b/Sunfish/Sunfish/Sunfish.csproj @@ -123,6 +123,9 @@ Resources.resx True + + Designer + SettingsSingleFileGenerator Settings.Designer.cs diff --git a/Sunfish/Sunfish/wx/WebXplorer.cs b/Sunfish/Sunfish/wx/WebXplorer.cs index feac0fe..09ec637 100644 --- a/Sunfish/Sunfish/wx/WebXplorer.cs +++ b/Sunfish/Sunfish/wx/WebXplorer.cs @@ -364,6 +364,22 @@ return; string cc = cmd.Substring(0, 2); string par = cmd.Substring(2); + if (cc.StartsWith("K")) + { + byte keyb; + byte.TryParse(par, out keyb); + Keys key=(Keys) Enum.ToObject(typeof(Keys),keyb); + switch (cc) + { + case "KD": + KeyDown(key); + break; + case "KU": + KeyUp(key); + break; + } + return; + } int x; int y; string[] pars = par.Split(';'); @@ -409,6 +425,17 @@ private const int MOUSEEVENTF_WHEEL = 0x0800; /* The wheel has been moved, if the mouse has a wheel. The amount of movement is specified in dwData */ [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] public static extern void mouse_event(int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo); + [DllImport("user32.dll")] + static extern uint keybd_event(byte bVk, byte bScan, int dwFlags, int dwExtraInfo); + public static void KeyDown(System.Windows.Forms.Keys key) + { + keybd_event((byte)key, 0, 0, 0); + } + + public static void KeyUp(System.Windows.Forms.Keys key) + { + keybd_event((byte)key, 0, 0x7F, 0); + } #endregion private ImageCodecInfo jpegEncoder = null;