Added support for keyboard text, and a few KB buttons.
Added variable listen port number and saving it.
This commit is contained in:
parent
63be44bf01
commit
0e3bed62dc
@ -1,6 +1,18 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
|
<configSections>
|
||||||
|
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
|
||||||
|
<section name="webcrab.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||||
|
</sectionGroup>
|
||||||
|
</configSections>
|
||||||
<startup>
|
<startup>
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/>
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/>
|
||||||
</startup>
|
</startup>
|
||||||
|
<userSettings>
|
||||||
|
<webcrab.My.MySettings>
|
||||||
|
<setting name="listenport" serializeAs="String">
|
||||||
|
<value>8080</value>
|
||||||
|
</setting>
|
||||||
|
</webcrab.My.MySettings>
|
||||||
|
</userSettings>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
12
webcrab/My Project/Settings.Designer.vb
generated
12
webcrab/My Project/Settings.Designer.vb
generated
@ -53,6 +53,18 @@ Namespace My
|
|||||||
Return defaultInstance
|
Return defaultInstance
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
<Global.System.Configuration.UserScopedSettingAttribute(), _
|
||||||
|
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||||
|
Global.System.Configuration.DefaultSettingValueAttribute("8080")> _
|
||||||
|
Public Property listenport() As UShort
|
||||||
|
Get
|
||||||
|
Return CType(Me("listenport"),UShort)
|
||||||
|
End Get
|
||||||
|
Set
|
||||||
|
Me("listenport") = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
End Class
|
End Class
|
||||||
End Namespace
|
End Namespace
|
||||||
|
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
|
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="My" GeneratedClassName="MySettings" UseMySettingsClassName="true">
|
||||||
<Profiles>
|
<Profiles />
|
||||||
<Profile Name="(Default)" />
|
<Settings>
|
||||||
</Profiles>
|
<Setting Name="listenport" Type="System.UInt16" Scope="User">
|
||||||
<Settings />
|
<Value Profile="(Default)">8080</Value>
|
||||||
|
</Setting>
|
||||||
|
</Settings>
|
||||||
</SettingsFile>
|
</SettingsFile>
|
@ -218,6 +218,11 @@ Module input
|
|||||||
keybd_event(bVK, 0, KEYEVENTF_KEYUP, 0)
|
keybd_event(bVK, 0, KEYEVENTF_KEYUP, 0)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Public Sub SendKeysEscaped(str As String)
|
||||||
|
str = System.Text.RegularExpressions.Regex.Replace(str, "[+^%~()\\{\\}]", "{$0}")
|
||||||
|
SendKeys.SendWait(str)
|
||||||
|
End Sub
|
||||||
|
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
End Module
|
End Module
|
||||||
|
44
webcrab/main.Designer.vb
generated
44
webcrab/main.Designer.vb
generated
@ -26,10 +26,10 @@ Partial Class main
|
|||||||
Me.LogText = New System.Windows.Forms.TextBox()
|
Me.LogText = New System.Windows.Forms.TextBox()
|
||||||
Me.Label1 = New System.Windows.Forms.Label()
|
Me.Label1 = New System.Windows.Forms.Label()
|
||||||
Me.TapInput = New System.Windows.Forms.NumericUpDown()
|
Me.TapInput = New System.Windows.Forms.NumericUpDown()
|
||||||
|
Me.PortInput = New System.Windows.Forms.NumericUpDown()
|
||||||
Me.Label2 = New System.Windows.Forms.Label()
|
Me.Label2 = New System.Windows.Forms.Label()
|
||||||
Me.DragInput = New System.Windows.Forms.NumericUpDown()
|
|
||||||
CType(Me.TapInput, System.ComponentModel.ISupportInitialize).BeginInit()
|
CType(Me.TapInput, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||||
CType(Me.DragInput, System.ComponentModel.ISupportInitialize).BeginInit()
|
CType(Me.PortInput, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||||
Me.SuspendLayout()
|
Me.SuspendLayout()
|
||||||
'
|
'
|
||||||
'StartButton
|
'StartButton
|
||||||
@ -59,7 +59,7 @@ Partial Class main
|
|||||||
'Label1
|
'Label1
|
||||||
'
|
'
|
||||||
Me.Label1.AutoSize = True
|
Me.Label1.AutoSize = True
|
||||||
Me.Label1.Location = New System.Drawing.Point(93, 17)
|
Me.Label1.Location = New System.Drawing.Point(221, 17)
|
||||||
Me.Label1.Name = "Label1"
|
Me.Label1.Name = "Label1"
|
||||||
Me.Label1.Size = New System.Drawing.Size(96, 13)
|
Me.Label1.Size = New System.Drawing.Size(96, 13)
|
||||||
Me.Label1.TabIndex = 2
|
Me.Label1.TabIndex = 2
|
||||||
@ -67,47 +67,47 @@ Partial Class main
|
|||||||
'
|
'
|
||||||
'TapInput
|
'TapInput
|
||||||
'
|
'
|
||||||
Me.TapInput.Location = New System.Drawing.Point(195, 14)
|
Me.TapInput.Location = New System.Drawing.Point(323, 15)
|
||||||
|
Me.TapInput.Maximum = New Decimal(New Integer() {1000, 0, 0, 0})
|
||||||
Me.TapInput.Name = "TapInput"
|
Me.TapInput.Name = "TapInput"
|
||||||
Me.TapInput.Size = New System.Drawing.Size(57, 20)
|
Me.TapInput.Size = New System.Drawing.Size(57, 20)
|
||||||
Me.TapInput.TabIndex = 3
|
Me.TapInput.TabIndex = 3
|
||||||
Me.TapInput.Value = New Decimal(New Integer() {5, 0, 0, 0})
|
Me.TapInput.Value = New Decimal(New Integer() {5, 0, 0, 0})
|
||||||
'
|
'
|
||||||
|
'PortInput
|
||||||
|
'
|
||||||
|
Me.PortInput.Location = New System.Drawing.Point(158, 15)
|
||||||
|
Me.PortInput.Maximum = New Decimal(New Integer() {65535, 0, 0, 0})
|
||||||
|
Me.PortInput.Minimum = New Decimal(New Integer() {1, 0, 0, 0})
|
||||||
|
Me.PortInput.Name = "PortInput"
|
||||||
|
Me.PortInput.Size = New System.Drawing.Size(57, 20)
|
||||||
|
Me.PortInput.TabIndex = 5
|
||||||
|
Me.PortInput.Value = New Decimal(New Integer() {8080, 0, 0, 0})
|
||||||
|
'
|
||||||
'Label2
|
'Label2
|
||||||
'
|
'
|
||||||
Me.Label2.AutoSize = True
|
Me.Label2.AutoSize = True
|
||||||
Me.Label2.Location = New System.Drawing.Point(258, 17)
|
Me.Label2.Location = New System.Drawing.Point(93, 17)
|
||||||
Me.Label2.Name = "Label2"
|
Me.Label2.Name = "Label2"
|
||||||
Me.Label2.Size = New System.Drawing.Size(83, 13)
|
Me.Label2.Size = New System.Drawing.Size(59, 13)
|
||||||
Me.Label2.TabIndex = 4
|
Me.Label2.TabIndex = 4
|
||||||
Me.Label2.Text = "Drag delay (ms):"
|
Me.Label2.Text = "Listen port:"
|
||||||
'
|
|
||||||
'DragInput
|
|
||||||
'
|
|
||||||
Me.DragInput.Increment = New Decimal(New Integer() {100, 0, 0, 0})
|
|
||||||
Me.DragInput.Location = New System.Drawing.Point(347, 14)
|
|
||||||
Me.DragInput.Maximum = New Decimal(New Integer() {2000, 0, 0, 0})
|
|
||||||
Me.DragInput.Minimum = New Decimal(New Integer() {100, 0, 0, 0})
|
|
||||||
Me.DragInput.Name = "DragInput"
|
|
||||||
Me.DragInput.Size = New System.Drawing.Size(57, 20)
|
|
||||||
Me.DragInput.TabIndex = 5
|
|
||||||
Me.DragInput.Value = New Decimal(New Integer() {300, 0, 0, 0})
|
|
||||||
'
|
'
|
||||||
'main
|
'main
|
||||||
'
|
'
|
||||||
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
||||||
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
|
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
|
||||||
Me.ClientSize = New System.Drawing.Size(555, 147)
|
Me.ClientSize = New System.Drawing.Size(555, 147)
|
||||||
Me.Controls.Add(Me.DragInput)
|
Me.Controls.Add(Me.PortInput)
|
||||||
Me.Controls.Add(Me.Label2)
|
Me.Controls.Add(Me.Label2)
|
||||||
Me.Controls.Add(Me.TapInput)
|
Me.Controls.Add(Me.TapInput)
|
||||||
Me.Controls.Add(Me.Label1)
|
Me.Controls.Add(Me.Label1)
|
||||||
Me.Controls.Add(Me.LogText)
|
Me.Controls.Add(Me.LogText)
|
||||||
Me.Controls.Add(Me.StartButton)
|
Me.Controls.Add(Me.StartButton)
|
||||||
Me.Name = "main"
|
Me.Name = "main"
|
||||||
Me.Text = "Form1"
|
Me.Text = "Webcrab server"
|
||||||
CType(Me.TapInput, System.ComponentModel.ISupportInitialize).EndInit()
|
CType(Me.TapInput, System.ComponentModel.ISupportInitialize).EndInit()
|
||||||
CType(Me.DragInput, System.ComponentModel.ISupportInitialize).EndInit()
|
CType(Me.PortInput, System.ComponentModel.ISupportInitialize).EndInit()
|
||||||
Me.ResumeLayout(False)
|
Me.ResumeLayout(False)
|
||||||
Me.PerformLayout()
|
Me.PerformLayout()
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ Partial Class main
|
|||||||
Friend WithEvents LogText As System.Windows.Forms.TextBox
|
Friend WithEvents LogText As System.Windows.Forms.TextBox
|
||||||
Friend WithEvents Label1 As System.Windows.Forms.Label
|
Friend WithEvents Label1 As System.Windows.Forms.Label
|
||||||
Friend WithEvents TapInput As System.Windows.Forms.NumericUpDown
|
Friend WithEvents TapInput As System.Windows.Forms.NumericUpDown
|
||||||
|
Friend WithEvents PortInput As System.Windows.Forms.NumericUpDown
|
||||||
Friend WithEvents Label2 As System.Windows.Forms.Label
|
Friend WithEvents Label2 As System.Windows.Forms.Label
|
||||||
Friend WithEvents DragInput As System.Windows.Forms.NumericUpDown
|
|
||||||
|
|
||||||
End Class
|
End Class
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
Imports System.Threading
|
Imports System.Threading
|
||||||
Imports System.Net
|
Imports System.Net
|
||||||
|
Imports System.Web
|
||||||
Public Class main
|
Public Class main
|
||||||
Dim weblistener As HttpListener
|
Dim weblistener As HttpListener
|
||||||
Dim lastpos As New Point(0, 0)
|
Dim lastpos As New Point(0, 0)
|
||||||
@ -11,11 +12,15 @@ Public Class main
|
|||||||
weblistener.Abort()
|
weblistener.Abort()
|
||||||
weblistener = Nothing
|
weblistener = Nothing
|
||||||
log("Stopped")
|
log("Stopped")
|
||||||
|
My.Settings("listenport") = CUShort(PortInput.Value)
|
||||||
|
My.Settings.Save()
|
||||||
StartButton.BackColor = Color.Lime
|
StartButton.BackColor = Color.Lime
|
||||||
StartButton.Text = "Start"
|
StartButton.Text = "Start"
|
||||||
Else
|
Else
|
||||||
|
Dim listenport As UShort = My.Settings("listenport")
|
||||||
|
PortInput.Value = listenport
|
||||||
weblistener = New HttpListener
|
weblistener = New HttpListener
|
||||||
weblistener.Prefixes.Add("http://*:8080/")
|
weblistener.Prefixes.Add("http://*:" & listenport & "/")
|
||||||
weblistener.Start()
|
weblistener.Start()
|
||||||
Dim listenthread As New Thread(AddressOf listenforconnection)
|
Dim listenthread As New Thread(AddressOf listenforconnection)
|
||||||
listenthread.Start()
|
listenthread.Start()
|
||||||
@ -47,7 +52,7 @@ Public Class main
|
|||||||
' check for valid command packets
|
' check for valid command packets
|
||||||
|
|
||||||
If path = "/" Then
|
If path = "/" Then
|
||||||
respstr = FileIO.FileSystem.ReadAllText("page.html")
|
respstr = FileIO.FileSystem.ReadAllText("res/page.html")
|
||||||
lastpacket = 0
|
lastpacket = 0
|
||||||
Else
|
Else
|
||||||
Dim pack As Long = context.Request.QueryString("seq")
|
Dim pack As Long = context.Request.QueryString("seq")
|
||||||
@ -162,7 +167,24 @@ Public Class main
|
|||||||
keybd_press(VK.MEDIA_NEXT_TRACK)
|
keybd_press(VK.MEDIA_NEXT_TRACK)
|
||||||
End Select
|
End Select
|
||||||
|
|
||||||
|
Case "key"
|
||||||
|
Select Case req.QueryString("k")
|
||||||
|
Case "del"
|
||||||
|
keybd_press(VK.DELETE)
|
||||||
|
Case "bksp"
|
||||||
|
keybd_press(VK.KEY_BACK)
|
||||||
|
Case "enter"
|
||||||
|
keybd_press(VK.RETURN_KEY)
|
||||||
|
End Select
|
||||||
|
|
||||||
Case "text"
|
Case "text"
|
||||||
|
Dim encodedtext As String = req.QueryString("t")
|
||||||
|
Dim decodedtext As String = Uri.UnescapeDataString(encodedtext)
|
||||||
|
Try
|
||||||
|
SendKeysEscaped(decodedtext)
|
||||||
|
Catch ex As Exception
|
||||||
|
log(ex.ToString)
|
||||||
|
End Try
|
||||||
|
|
||||||
Case Else
|
Case Else
|
||||||
Return "bad"
|
Return "bad"
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>webmouse client</title>
|
<title>webcrab client</title>
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@ -147,7 +147,7 @@ function handleCancel(evt) {
|
|||||||
|
|
||||||
function handlekeypress(evt) {
|
function handlekeypress(evt) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
sendmessage("text", evt.target.value, 0)
|
sendmessage("text", "t=" + encodeURIComponent(evt.target.value));
|
||||||
evt.target.value = "";
|
evt.target.value = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user