0

I am using basic4android and have created an application which simply stores and pushes all mobile phone keystrokes. This is functioning when I storing and dumping the data remotely online, however I am attempting to store the data to display on a listening vb6 form application. Basically each time a new record of X number of words is triggered, it should simply display that text block on my running VB form label. Please note I am using a usb cable from the device to the PC. Sorry about the noob question.

How can I push data from my android device to my listening VB6 form app via USB?

Thanks.

2 Answers2

1

This is a tricky one, since it is not obvious what is the driver that is talking to the android phone. If you are lucky, the driver maps itself to a COM port. For instance, on my box, the "Samsung Mobile USB Modem #2" device maps itself to COM4.

If your device is using a COM port mapping, then add the Microsoft Comm Control to your Components list. Simple code which waits for input forever, and writes to Debug.Print is as follows:

If MSComm1.PortOpen = True Then MSComm1.PortOpen = False
MSComm1.CommPort = "4"  ' <===  "1" = COM1, "2" = COM2, "3" = COM3, "4" = COM4
MSComm1.Settings = "1200,n,8,1" ' You can probably replace 1200 with a much higher value, e.g. 230400
MSComm1.RThreshold = 1
MSComm1.InputLen = 1
MSComm1.PortOpen = True
Do
    DoEvents
    Debug.Print MSComm1.Input
Loop Until False

If the driver uses other mechanisms, this will be a lot more complicated, and require messing around with drivers and the Windows API - not for the faint-hearted.

Mark Bertenshaw
  • 5,594
  • 2
  • 27
  • 40
1

Like Mark Bertenshaw said, although I wouldn't loop to obtain the data but use the OnComm() event:

Private Sub MSComm1_OnComm()
  Dim strInput As String
  Select Case MSComm1.CommEvent
    Case comEvReceive
      strInput = MSComm1.Input
      Debug.Print strInput
  End Select
End Sub
Hrqls
  • 2,944
  • 4
  • 34
  • 54