1

I have a VB6 script that creates a MSComm with my device, once communication is create I go and upload a file to the device via DLL file that is included within VB6 script

The problem that I am facing is that my VB6 somehow hijacking device and I am unable to upload a file. Rather than taking 1 minute to upload a file application takes forever.

I have tried following, after communication was created and MSComm1.OpenPort = True to set MSComm1.OpenPort = False but communication is still hijacked, so I need re plug my device into USB port and still nothing works (however sometimes it did work for an unknown reason, but i did have to wait a while)

However, when I trigger file uplaod without VB6 script creating MSComm communication with device my file is uploaded successfully.

I presume that this is something to do with MSComm and I presume that I need to shut it down somehow??

I need to have MSComm initially because I want to fetch some data about my device.


I run a command that finds a port number that I can use within VB6 after that i run MSComm.PortOpen = false; afterwards I put in file location and port number into function from DLL and run command.

On the initial run i receive an error that device is not connected, so i reconnect device, but on the second run everything seems to work except i have to wait and nothing happens. when i run DLL on its own process returns success in under 1 minutes

My settings for MS Comm within VB6

DTREnable = True
EOFEnable = False
Handshaking = 0
InBufferSize = 3200
InputLen = 0
InputMode = 0
Left = 6120
OutBufferSize = 0
RThreshold = 0
RTSenable = False
Settings = 2400,n,8,2
SThreshold = 0
Vlad Vladimir Hercules
  • 1,781
  • 2
  • 20
  • 37
  • There is no `OpenPort` property, perhaps you mean `PortOpen` instead. But it seems likely you have a program bug and simply haven't closed the port. – Bob77 Feb 23 '15 at 13:20
  • please post the (relevant) code of that script or the code in which you try to use that script – Hrqls Feb 23 '15 at 13:45
  • I am unable to show a real example because of too much code. But basically I run a command that finds a port number that I can use within VB6 after that i run MSComm.PortOpen = false; afterwards I put in file location and port number into function from DLL and run command. On the initial run i receive an error that device is not connected, so i reconnect device, but on the second run everything seems to work except i have to wait and nothing happens. when i run DLL on its own process returns success in under 1 minutes. – Vlad Vladimir Hercules Feb 23 '15 at 16:43
  • USB device? Isn't this a serial control? – Rob Feb 23 '15 at 18:09
  • well, the MS Comm code i have in vb6 enables me to read data on the device.. – Vlad Vladimir Hercules Feb 23 '15 at 18:24
  • I have looking into DLL library and it seems like I get error 5 (GetLastError) when I am trying to read the device. I have a write call before read and that one worked fine. – Vlad Vladimir Hercules Feb 24 '15 at 17:22

0 Answers0