Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

How To Check If A Comm Port Have Connected With A Device?

How to check if a comm port have connected with a device?

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Checking To See If A Device Is Connected To A COM Port
How do I do that without screwing up the communication?

What I want to do, is to establish a connection to my P800 when it has been out of Bluetooth range..

All I have to do, is open a serial connection on COM 3, and the phone management software establishes a new connection on COM 4 and closes COM 3 again..

So how do I check if COM 4 is in use or not?

Detect Whether The External Device Is Connected To Com Port 1 Or 2

I have connected an external device to commport1 and I have written Mscomm1.Commport=1 in VB 6.0 and I was able to pass the data to the device and receive acknowledgement.
In case if I connect the device to commport 2 I have to change my code to Mscomm1.Commport=2 . instead can I identify to which comm port the external device is connected and change dynamically.
Can someone help me.


How Do U Read Data From Bluetooth Device Connected To USB Port
Hi guys

i am tryin to read incomin data from my bluetooth device. i have a Widcomm USB bluetooth connected to my PC

i have no idea how to read the data from my bluetooth. i want use visual basic 6 or visual to do this. cox its the only language i knw

can this be done using visual basic. if so please lead me to some documentation or source codes.

thankx in advace

Please Help its urgent

Edited by - ibrahim@naeem on 7/24/2005 4:49:20 AM

Connect COMM Port Of One Computer To Mouse Port Of Another
I would like to control the mouse of one computer with commands sent through the COMM port of another computer. This would allow me to automatically run certain data acquisition programs on the second computer withoun my having to point and click. I've been searching for information about this in the forums and on the web, but I haven't found anything. Any help would be appreciated.

How Do I Autostart My App When A New Device Is Connected?
Hi There!

I would like my app to autostart when a device is connected.
More spesific, I want my application to start at once when you connect your APPLE IPOD to your computer. How do i do this?

Do I have to like, autostart my program when windows boot, let it be in the system bar and it just idle and checking all the time if new device is connected, and if yes, it "starts" ? How can I solve that?

Or can I write something to registry telling that when this USB device or other device is attached, it will auto launch my program?

Thanks a billion, a few pointers would be very appreciated


Searching To See If A Hardware Device Is Connected Or Not
Hi, I'm back with another problem, this is also for my A-level Computing coursework,
when the project is used by my user it will be running on a school network, some of my users will however require access to the files on the network drives, or in the event that the school network fails they still want to be able to run the program off of the C drive off of the computer currently being worked on.
My Program needs to be able to search if the machine is connected to the network if it is it needs to open one login screen, if not it needs to open another one.
Any ideas please.

VB Connect To Windows CE Connected Device.
Is there a way when a Windows CE device is connected to via craddle and active sync to be able to access data either from a vb program running on the device or from the pc to the device?  We'd like to do some updating of files on the devices but not just overwrite with the normal active sync connection.  Thanks, Joe

Error Reading Comm Device

I have a problem with the MSComm. I have not found answers to this anywhere. It would be great if somebody could help!

I have connected my Nokia 6650 phone to my PC (W2K Pro) with a DKU-5 -cable. I can send AT commands to it via MSComm, but MSComm.input throws error "error reading comm device".

Current code:


'CONNECTING (this works ok)
' 9600 baud, no parity, 8 data, and 1 stop bit.
MyComm.Settings = "9600,N,8,1"
' RTS logical "high" = 1
MyComm.RThreshold = 1
MyComm.SThreshold = 1
MyComm.Handshaking = comRTS
MyComm.RTSEnable = True
On Error Resume Next
MyComm.PortOpen = True
If Err.Number > 0 Then
Label4.Caption = "Unable to open"
Exit Sub
End If

'COMM EVENT (jumps here when commands are sent to phone)
Private Sub MSComm1_OnComm()
Select Case MSComm1.CommEvent
Case comEvReceive 'Character has arrived in recv buffer
Do While MSComm1.InBufferCount > 0
'store the received character
strRx = strRx & MSComm1.Input <-------- throws an error!
PrintData (strRx)
Case Is > 1000 'in case of error
PrintData ("COM error " + MSComm1.CommEvent)
End Select
End Sub


I have tried all possible settings for the MSComm control, but nothing seems to fix this. I need help!


- Jari Pulkkinen

Device Names On Comm Ports
Hi Guys

Can somebody help me I am new to eVB. I am trying to get the names of devices that are on a comm port to be displayed in a listbox. I have seen this done in other programs like ones that let you select what comm port a Navman is on.

Thanks for any help



How Can I Activate/deactivate A Device Connected To LPT1 With Vb?
Hi everybody,

My requirement is to activate an external device say, MP3 player for
half an hour after that it should be deactived and also by default it
should be deactivated. How can I do this? Pls specify the dll for this?
After all it is a timer related switching s/w!!!
With LOVE,
Thanxs in advance

How To Read Data From FireWire Connected Device?

How to read data from a device connected via Firewire?
Any suggestion is appreciated!



How To Find Out Whether An External Device Is Connected To The Computer
i have a dictaphone which i m attaching 2 my computer.How can i find out whether it has been attached or not?How will i b able 2 access the dictaphone through the computer?

How To Get Data Into TextBox From BARCODER Device Using MS COMM Control
How to get data into TextBox from BARCODER device using MS COMM control / Reading Port


How To Check Connection To DB Is Connected And How To Check Record Set Really Have Result?
Code:Set DB = New ADODB.Connection
DB.ConnectionString = "Provider=" & DB_PROVIDER & ";" & _
           "Network Library=DBMSSOCN;" & _
           "Data Source=" & strSQLServer & _
           "; Initial Catalog = " & strDatabaseName & _
           "; User ID = " & strUserID & _
           "; Password = " & strPassWord
debug.print DB.state

Question : How can I check is the DB connection really connected (active)?
i use DB.state
and the result show 1
is it ok, if not please give suggestion?

sSQL = "Select * from table1"
  Set RS = New ADODB.Recordset
  RS.ActiveConnection = DB
  RS.Source = sSQL

debug.print rs.recordCount

Question : I want to know how many record were find from the query. When I use debug.print rs.recordCount, it show -1. is it mean there is no record found? Should I use instead?

I am confussing how to get record set and why there is no result from the query... something wrong?

Comm Port
i'm not sure with the terms i used... correct me if i'm wrong.

how can i get the data passed from the port.?

coz i purchased a MODEM pointing to my comm port, then i want to get the data passed on it.? how?

is it possible?

Comm Port !
hello everyone !

i'm doing serial communiction thru comm port in my applcation. in the application startup- form load event i'm setting comm port 1 as default. but there's a prob suppose some computer have comm2 to be set starts giving error messages in the beginning.

how can i chk which current port is available or being used by my hardware and then set it by default in the form load event. tell me how to chk for available port ....

thanks in advance

shruti !

Using COMM Port
How might I communicate with a Sharp El-6790 Organizer using the COMM control? It's plugged into COMM2 and the software that comes with it works fine. I'm just interested in making my own. Any ideas? Thanks

Comm Port
I have a scanner which can read barcodes. It is connected to my comm port 1. How do i get it to display on a text box or label what it has read? Please HELP!

Comm Port
This Is Sort Of Complicated, Maybe someone can help

Basically what i need to do is trigger 5 diffrent motors through a comm port.


is there a way to know which port the modem is located at during run time?

Comm Port
During a (fax)-session, while the commport is in use, I will stop my program. How can I notice that the comm port is in use or not in use ?


Comm Port
I am attempting to write a small program to receive data from a custom radio (modem). The radio uses CST and RTS pins to control transmittion. I tried to use the MSComm1.Handshaking = 0 since the data is only one byte and I dont have to be conserned with overflowing. The radio does not receive when I have it plugged into serial port but starts receiveing when I dissconnect. I asume its the RTS pin on the serial port that is preventing data flow.


VB.6 User, Since 2002
Next Generation Lighting Controls

Comm Port
Hi there.

I'm working on an application that I need to solicit a scale in order for it to send a weight. The scale is hooked to the comm port and I understand the commands that need to be in the program as I have accomplished that before. The catch on this project is that they now have switch to a different scale manufacturer which means a different solicit. This scale manf. wants a Ctrl S. How do I format that command in the .output command? I thought I sent "^S" but it is not responding to it.

Thanks for helping me on this.


Comm Port
How to write data (like Dial Number) into "Modem port "?

Comm Port
Hi there,
I am not sure if I am asking this question in the correct section.

I am seeking help for some VB.NET code which I can interact with the Comm Port of the computer.
For example, if I click on a button, how do we send an output to the comm port?

Can somebody help me on this?

THanks A lot..

code for fun, for to code

how can i read incomming signals from a commport??????
And send them back, by which pins does it all go?????

Comm Port
how can i connect to a comm port with VB??? And with which "plugs" can i send a signal into the computer???
How much Volt goes in and out???
Please help me out!!!!!!

Comm Port
How can i connect to a comm port, and use it to control sommething, a device (that is connected to the comm port).

How To Detect If LPT Port Connected?
Using VB5 on Windows 95, how can you detect if a printer is connected to a LPT port? This needs to be achieved without the use of Windows drivers of the Printers object.

&lt;Open "LPT" for ...&gt; is not reliable and causes program to halt.

Any ideas?

Comm Port List
I'm looking for a way to list the available comm ports on a system. Just the serial ports (including any usb-serial devices). Like they are listed in the Device Manager in WinXP. Example:

Commincations Port (Com1)
Commincations Port (Com2)
Proflic USB-to-Serial Comm Port (Com4)


Varying The Comm Port

is there a way to access numerous comm ports using only one MSComm Control?
I need to identify the comm port tat a specific device is using and i hv several of such similar devices that is connected. Thus i wish to know which device is using which comm port.
Each device can be set to send in a certain data so i can identify the device using the data send in. I thought of scanning each comm port using the for loop ( 1 to 16 ) and compare wif the default data to identify the devices.
However, I cannot insert in the loop to make the next device send in the data without changing the comm port manually in the program.
I hv use the On_Comm event and two timer(one to request for data and another to request data after time out) to help retrieve the data.
Also, is there a command to resume or carry on the program because if the port is use by other devices, it will juz keep reading the data (though no data is being receive- I hv written to keep requesting for data if no data is receive.)
Sorry for the long qn. Do really hope someone can advise me on this issue.
Thanks a lot!

Open Comm Port
Hallo hi...

I'm facing a problem to open comm port by using 'mscomm control'.
I'm using the default setting in mscomm properties.

When I tried to open port then error message ' invalid port number'

Private Sub Form_Load()

MsgBox MSComm1.CommPort
MsgBox MSComm1.Settings

If MSComm1.PortOpen = False Then
MSComm1.PortOpen = True ' this line gerenate error message
End If

End Sub

please help...

Comm Port Monitor
Here at work, I have the task of figuring out why a particular modem has a high connection failure rate.

There are several pieces that I need to see what's going on "under the hood" from the modem's point of view.

I've just finished rolling my own terminal emulator using the mscomm control.
I need it to allow my vb program to communicate with the local modem via 'AT' interogation commands.
(now here's where I need some help):
The next thing I want to do is to monitor the activity on the comm port that connects to the modem. I need to see the ascii traffic to and from the modem.

I'm thinking winsock but is it udp or tcp?
Overall I'm confused. Before I go down a rat hole, I just need a jump start. I'm not looking for you to write my program for me.

Just to point me in the right direction.

How To Detect The Comm Port?
I got problem about comm port programming, i will not able to detect if my device is currently connected or if my program was able to connect to the device.

can you help me about my problem? I really don't know how to detect a certain device in a comm port.

Calling My Comm-port
Hi, I would like to make a event code for setting on/off a relay with my comm port. I know that i can use mscomm. But if i want to turn on/off a relay or motor with a commandbutton, how should i program it? What pins do i need on my serial port? How can i connect the relay/motor with my port? Is there somebody how have's documentation about the signals that you have on the different pins of the serial/parrallel ports?

Comm Port Trouble
We have a vb6 program in windows 98 operating system that calls 2
DLL's to control a comm port. The one that we wrote in "C" works fine,
expects the comm port to be closed. The controller card company's dll
supposedly opens the comm port in a "shared" mode, which is suppose to
us open the comm port in our own dll with no problems. This doesn't
correctly cause when our dll tries to open the comm port, it is already
open. Is there a way that we can close the comm port from vb? Once we
close the executable program and restart the program and only call our
it works fine until we call their dll again. Can we unload their dll
we finish using the functions in their dll that we need and if so do you
have an example of doing that in VB? Please HHEEELLLLPPPPPP!!!!!!
Thank you for any assistance you can give me in advance.


Gary Curry
Irwin Research & Development
Phone: (509) 248-0194 Ext. 277

Talk To Comm Port
How i want to send a signal to Comm port no 3 if any condition occur in my system..i want to control a gate in cassete conveyor..the gate will connect using comm port 3..then if error occur in mysytem..the gate is will not open..
how to send a signal?
what kind is better signal to send? (0/1, TRUE/FALSE OR OTHERS)

Connecting To Comm Port Via VB6.
I am developing an application that requires signals to be send through the comm port to a microcontroller.I am using VB6 on WindowsXp SP2.I need to know how can I communicate with the Comm Ports using VB6?

Comm Port Busy
Whenever I run my VB6 program and it crashes after I opened a COM port, the next time I try to run it from IDE, I get a busy COM port. I have to save my program and restart VB every time I get a bug in my program.

Is there a way to fix this or is there a way to add cleanup code to the VB IDE so that open COM ports are automatically closed when the program is ended?

Newbie Needs Help With Comm Port
Hi everyone, this must have been asked before, but I'm on dial up and every page takes forever to load, so I'll ask.

I know the basics of Visual Basic and I need to write a program (no money to hire someone to do it for me) that is always listening to the COM2. If it detects data, it must do something.

Can anyone give me a piece of code to be always listening to the COM2? And how do I retrieve the data from it? (I have to save that data on a database, but I know how to do that).

Thanks a lot from a girl in need (of some programming knowledge, hey! what were you thinking?? lol)

Windows CE Comm Port
Hi Dont know if I have put this request in the right place, but here goes...

I am trying to write and application for windows ce, I have the SDK and all has been ok and working fine.
I now want to access the comm port on the machine, I have the comms component added and ready, but as I'm running the software in the emulator supplied with the SDK, should it try to access the comms port on my development machine or will it try do some else weird???

Get List Of Available Comm Port.
Dear All,

How to get list of available comm port thru VB6's code? .. please advise ..


Get List Of Available Comm Port
Dear All,

How to get list of available comm port thru VB6's code? .. please advise ..


Comm Port Question?
I have started to do this a long time ago but decided to quit do to a lot of O.T.
Now I would like to resume where I left off.
Iím working on a small app. That will open up the Comm Port1 and is supposed to program a Chip via a pocket Programmer.
ďIím a beginner so if the following Questions bother you just go on and donít worry about answering themĒ.
What I would like to know is, Am I going to have to load the buffer first in order to program the chip? If so how do I go about it? (I was unable to find any info on the web so if someone knows where to start it would be appreciated).
I would also appreciate some help in cleaning up some of my code, Iím using 2 Images of a Diode one red and the other green and Iím using a bunch of If Then to hide and show them, now I know there is a neater way to do this but I forgot how to do it.


Comm Port Monitor
Here at work, I have the task of figuring out why a particular modem has a high connection failure rate.

There are several pieces that I need to see what's going on "under the hood" from the modem's point of view.

I've just finished rolling my own terminal emulator using the mscomm control.
I need it to allow my vb program to communicate with the local modem via 'AT' interogation commands.
(now here's where I need some help):
The next thing I want to do is to monitor the activity on the comm port that connects to the modem. I need to see the ascii traffic to and from the modem.

I'm thinking winsock but is it udp or tcp?
Overall I'm confused. Before I go down a rat hole, I just need a jump start. I'm not looking for you to write my program for me.

Just to point me in the right direction.

Comm Port Question

is the internet modem connection is a comm port? if so, how can i know which port is it?


Comm Port Question
How can I read the CTS of a comm port without using the MScomm.ocx.

Is there a command or an API call for this?

Ken ?Mason

VB Comm Port Access
I'm trying to use VB to access the serial port (COMM1) on my PC. I cannot seem to figure out how to do that. Can anyone help me???

Which Comm Port Is Modem On?
How do I find out which comm port the default modem is on.

Guess there must be a reg entry.

Anyone guide me to where it is?


Copyright © 2005-08, All rights reserved