Sample USB port program in Visual Basic


Thread Starter



Can someone please provide me the sample code for USB port programming in VB6?

email: to.go @ gmx. de


Robert Scott

There is no such thing as simply writing to a USB port in VB6. You write to devices that just happen to be on the USB port. Each device can have its own driver and therefore its own interface with VB6.

If you are thinking of writing to a USB-hosted serial port, then you would just access that port the same as if it were a legacy serial port, by name ("COM1", "COM2", etc.). So instead of trying to figure out how to talk to USB, just figure out how to call a serial port in VB6. I know how to do it in C++ using the Win32 API, but I don't know the VB6 equivalent.

Robert Scott
Real-Time Specialties
Ypsilanti, Michigan

Jose Auugusto

Hello Robert,

Can you send your C++ implementation of USB to me?
I'm trying to do this but I'm not finding much content on the internet.


Jose Augusto Stuchi
gutousp @ gmail. com
University of Sao Paulo - Brazil

Robert Scott

I said there is no such thing. Most people who ask for USB code are really asking for serial code to talk to a USB-to-serial converter. If this is what you want, then don't look for code for USB. Look for code for serial communication. A good place to start is Microsoft's MSDN web site:

Robert Scott
Real-Time Specialties
Embedded Systems Consulting
I am also looking around for docs in serial communication with C++ but I cannot find anything. Is there a component in C++ like the MSCOMM in VB for serial com? If yes, what is it in C++? Can you please give me some clues or send files which can help me for a start?

I would realy appreciate that. Thanks.
Since you are using C++, you do not need an object like MSCOMM. Use the file I/O API to open, read and write a COMx port. It is not difficult.

But how do I do that Bill? I have never done port communication or such things. Can you please give the procedure and a sample of code? Thanks.

nnalarissa @ gmail. com
Hi dear..

I also want to make project on port programming but coding must be in VB 6.0, it's a strict rule in our university.

So will you please tell me some basics about how to use the USB ports in VB? Please reply to me, it's compulsory for me... I hope you will help me...

If anybody what to use their parallel port for controlling devices, you can relay on me. I have the program in VB6. I will help you.If interested contact me.

email:staytunedfriends [at]
Does it work the same way with a parallel port device converter to usb; Cause i have a code on C++ builder to control a device from parallel port. The same code would control the device with the converter.

Thank you.