Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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.
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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 …
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

715 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