Sending keystrokes to another comptuer.

Posted on 1999-06-25
Medium Priority
Last Modified: 2013-11-13
I have an ActiveX application that runs here on our Intranet.  How do I get the application(running on a client) to send keystrokes to an application running on the server. Please be specific.  
Question by:Tom_Hickerson
  • 2

Expert Comment

ID: 1519793
you can use the RDS for execute commands in your web server.

1 - In your WEB server install all Data Access Components (RDS, ADO,...) from NT Option pack.

3 - Create a ActiveX DLL (your Server Businnes Object) :
(Compile and register in your server) :

Private Sub Class_Initialize()
  'class setup code here
End Sub

Public Function GetKeystrokes(ByVal param1 As String, ByVal param2 As String) As Long '...

End Function

Private Sub Class_Terminate()
  'class cleanup code here
End Sub

4 - In your Client project  :
(add the Microsoft Remote Data Services reference)

Private Sub SendKeysStrokes_Click()

  Dim ads As New RDS.DataSpace
  dim bo as Object
  Set ads = CreateObject("RDS.DataSpace")
  Set bo = ads.CreateObject("VbBusObj.VbBusObjCls", "Http://yourWEBserver")
  Dim objADORs As Object

  bo.GetKeyStrokes("xxx", "yyyy")

End Sub


Author Comment

ID: 1519794
1.  How do I insall data access components to Microsoft Information Server 3.0.  

2. How do I add the Microsoft Remote Data Services reference.

I do not see these options anywhere.


Expert Comment

ID: 1519795

in your server the RDS, ADO,... you install from NT option pack 4.0

in your client the RDS you install from VB6

if you don't have these features, you can use the WinSock from VB5.

you can use the code below :

---- the server application (Standard Exe) -----
(compile and install in your server)

- add then Microsoft WinSock Control (components) in your project;

- set the Name property to sckServer;
- set the Index property to 0;

- Paste the code below :

Dim intMax as Long

Private Sub Form_Load()
    intMax = 0
    sckServer(0).LocalPort = 1600

End Sub

Private Sub sckServer_ConnectionRequest(Index As Integer, ByVal requestID As Long)

    intMax = intMax + 1
    Load sckServer(intMax)
    sckServer(intMax).LocalPort = 0
    sckServer(intMax).Accept requestID

End Sub

Private Sub sckServer_DataArrival(Index As Integer, ByVal bytesTotal As Long)
    dim DRec as String

    sckServer(Index).GetData DRec, vbString 'get the keystroke

    If Ucase(DRec) = "QUIT" Then
        sckServer_Close Index

    MsgBox "The Client Sent : " & DRec

End Sub

Private Sub sckServer_Close(Index As Integer)

    sckServer(Index).LocalPort = 0

End Sub

--- The Client Application ---

- add then Microsoft WinSock Control (components) in your project;

- set the Name property to sktClient;

Private Sub cmdCloseConnection_Click()
    Debug.Print "Closing Connection"
    ' Don't terminate the connection like this:
    '     sktClient.Close
    sktClient.SendData "QUIT"
    End Sub

Private Sub cmdConnect_Click()
    If sktClient.State <> sckClosed Then
    End If
    With sktClient
        .RemoteHost = "" 'your server IP address
        .RemotePort = 1600
        End With
    End Sub

Private Sub Form_QueryUnload(Cancel As Integer, _
                             UnloadMode As Integer)
End Sub

Private Sub sktClient_Close()

        Debug.Print "Status: " & _
        Loop Until sktClient.State = sckClosed
End Sub

Private Sub sktClient_Connect()

    If sktClient.State = sckConnected Then
        Debug.Print "Connection Successful at Remote IP " & _
        End If
End Sub

Private Sub sktClient_DataArrival(ByVal bytesTotal As Long)
    Dim vtData As Variant
    sktClient.GetData vtData, vbString
    MsgBox "Server Sent : " & vtData
End Sub

Private Sub cmdSendKeyStroke_Click()

    sktClient.SendData "Test....."
End Sub


Accepted Solution

davepcam1 earned 200 total points
ID: 1519796
create a simple server app on the intranet computers,
use a tcp/ip protocol (use maybe the winsock.ocx)
when it recieves the data from the other computer use vb's sendkeys function e.g

private sub winsock1_dataarival(bytestotal as long)
dim buffer as string
winsock1.getdata buffer, vbstring
if instr(1,buffer,"TAB") then sendkeys("{TAB}",false)

end sub


Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question