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




Get List Of Available Comm Port.


Dear All,

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

Regards
Winanjaya




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
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)

Thanks,
Matt

Get List Of Available Comm Port
Dear All,

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

Regards
Winanjaya

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.

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 .....it 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
Hi!
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.

---------------------
SLAMMER
---------------------

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.

Anyone



VB.6 User, Since 2002
Next Generation Lighting Controls
www.jmelectronics-online.com

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.

Jule

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
================

COMM Port
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).

Varying The Comm Port
hi,

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
Hello:
We have a vb6 program in windows 98 operating system that calls 2
separate
DLL's to control a comm port. The one that we wrote in "C" works fine,
but
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
let
us open the comm port in our own dll with no problems. This doesn't
work
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
dll
it works fine until we call their dll again. Can we unload their dll
when
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.

Sincerely

Gary Curry
Irwin Research & Development
E-mail: gcurry@irwinresearch.com
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???
Thanks

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.

Thanks!!

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
hello,

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

thanx.

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?


Thanks

Detect Comm Port
This is my code to dail from my phone program

Private Sub cmdHome_Click()
Dim Number$, Temp$
Hangup.Enabled = True
Number$ = (Text1.Text)
Temp$ = Status
Status = "Dialing " + Number$
Dial Number$
Status = Temp$
End Sub

This is the code that was posted to detect a comm port

vbCOMS.Settings = "9600,N,8,1"
vbCOMS.CommPort = 1
vbCOMR.Settings = "9600,N,8,1"
vbCOMR.CommPort = 2

With vbCOMS
'' test what COM ports we have
On Error GoTo P

'' maximum of 16 COM ports
For cnt = 1 To 16 Step 1
.CommPort = cnt
.PortOpen = True
If (vbCOMS.PortOpen) Then
Call Me.cboPortSend.AddItem(cnt)
Call cboPortRec.AddItem(cnt)
End If
.PortOpen = False
DoEvents
Next cnt
End With

Exit Sub

P:
Debug.Print "On COM:" & vbCOMS.CommPort & " error: " & Err.Number & " : " & Err.Description
If (vbCOMS.PortOpen) Then vbCOMS.PortOpen = False
Resume Next

My question is: Can I?..How can I?....blend these two together and detect whatever comm port the modem is on and dial the number when i press the button

Comm Port Pin Manipulation
To control an external device I need to set certain serial port pins high and low and connect some together.
Can this be done in VB5.0?

Comm Port Pin Manipulation
To control an external device I need to set certain serial port pins high and low and connect some together.
Can this be done in VB5.0?

Comm Port Status
Does anybody know if and how I can get the status of the input line on comm port 1, using either an API call or some other method.

Thanks
Elroacho

Reading From Comm Port
Hi,

I have connected an electonic weighing scale to
CommPort 2 on my pc. I want to continuously read the
contents of the weight into the textbox.
This is what I have done but I am not successful. It
displays some junk characters at times. Can someone
please help me.

On a form I have placed a TextBox, Timer and MSComm.



Private Sub Form_Load()
Timer1.Enabled = True
Timer1.Interval = 1
MSComm1.CommPort = 2
MSComm1.PortOpen = True
End Sub



Private Sub Timer1_Timer()
Text1.Text = MSComm1.Input
End Sub

RE-Reading From Comm Port
hi
Most weighing machines send out a trigger chr within the string
(STX, +/- or a CR)
if you set the comms port to read in 1 chr at a time until you fnd
the
trigger then change the read length to take in the required weigt
Chr's then display should solve your problem

John Shepherd

Comm Port Programming
I am trying to find a way to change comm ports via code.
Example:

Make COM 5 change to COM 3.

If anyone can help I would greatly appreciate it.

Thanks



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~

Help In Needed With Comm Port
Hi All
I have a program in gwbasic to interface with a data
logger; it is working well. My supervisor wrote the program in a
Visual basic trying to use it as a macro in an excel sheet so the
data is directly dumped to the excel sheet and simultaneously poltted on a curve. He
couldn't get the dada logger to communicate with VBasic macro through COM
port.
Any one has any idea how to solve this problem?
Thanks All

Comm Port Trubles
I have made this little funktion and compiled it in a dll for use on a website.
The dll was ment to be used to show state of comm ports on a dialout server
but here the trubles begin

on the dialout server there is 60 virtuel comm ports and this dll only works with the first 9 on the rest it's always displays buisy

i have tryed to connect 60 actual ports to see in it was the virtuel ports cousing the problems but no luck there.

it seems like the upper boundry for communicating with comm ports in vb is 9
or am i missing somthing here ?

when trying to access ports higere than 9 hCOM always returns -1 regardless of the port state

Can anyone help ?

visual basic code:

'API Declarations
Private Declare Function CreateFile Lib "kernel32.dll" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long, lpSecurityAttributes As SECURITY_ATTRIBUTES, ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) As Long
Private Declare Function CloseHandle Lib "kernel32.dll" (ByVal hObject As Long) As Long

'API Structures
Private Type SECURITY_ATTRIBUTES
nLength As Long
lpSecurityDescriptor As Long
bInheritHandle As Long
End Type

'API constants
Private Const FILE_SHARE_READ = &H1
Private Const FILE_SHARE_WRITE = &H2
Private Const OPEN_EXISTING = 3
Private Const FILE_ATTRIBUTE_NORMAL = &H80
'Returner TRUE hvis COM er tilgængelig, FALSE hvis COM er optaget
Public Function COMAvailable(COMNum As Integer) As Boolean
Dim hCOM As Long
Dim ret As Long
Dim sec As SECURITY_ATTRIBUTES
'trying to open the comm port
hCOM = CreateFile("COM" & COMNum & "", 0, FILE_SHARE_READ + FILE_SHARE_WRITE, sec, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0)
If hCOM = -1 Then
COMAvailable = False
Else
COMAvailable = True
'close COMM
ret = CloseHandle(hCOM)
End If
End Function


Regards

Gizmoz

Comm Port Error
Hi,

I'm now trying to get a program.. to communicate with a total positioning device. Anyway, I still dunno whether my code is correct or wrong cuz when I run the program, there's comm port error 1001.. break signal was received. Please tell me what causes it and how to solve this problem.

Here is my code i use for communicating..

Private Sub Form_Load()
With MSComm1
.CommPort = 1 'Open communication with Comm Port1
.Settings = "19200,E,7,1" '19200 baud, even parity, 7 data, and 1 stop bit
.InputLen = 0 'Read entire buffer of MSComm1.nput
.PortOpen = True 'Open Comm Port
.Output = "ATQ0V1E1S0=0" + Chr(13) 'Activate Comm Port
.Handshaking = 1 'comXOnXOff
End With
End Sub


Private Sub MSComm1_OnComm()
If MSComm1.CommEvent = comEvReceive Then
txtDisplay.Text = "Ready" & vbCrLf
If MSComm1.Input = "@E209" Then
txtDisplay.Text = "Instrument not calibrated yet" & vbCrLf
End If
Else
MsgBox "Comm Port Error", vbOKOnly, "error"
txtDisplay.Text = "Comm Port Error" + Str(MSComm1.CommEvent)
End If
End Sub

Thanks in advance!

Streaming Voice Through Comm Port
is it possible to stream audio through serial port ???
well i found a dlll (wavestream.dll) to stream audio through winsock connection
can be used usefully in internet chatting programs
can this idea work on serial port
can any1 pls help me and guide me how to do so???

well i included the wavestream source code for guidence hope u can help

Comm Port Sharing Question
Hi guys.

can anyone help me with this one?

i am writing a program to read data from a weighing machine using a MsComm control. Unfortunately there is already a program running on the same pc occupying port : comm1 reading off from the same weighing machine. Can i intercept the data, or can i use comm2 to read instead?

Thanks

VB Ms Comm To Control Your PC Serial Port
Hi guys, I'm really REALLY new to VB and i would like to learn more. I have been given a task to complete, and i seriously don't know where to start. I hope you guys could give me some guidance and examples.

TASK:writing simple codes in VB you can send some ‘On’ and ‘Off’ state to your serial TX output. You should be able to see some results from the MMU. You will find that the voltage would be too high and not feasible for your circuits. That is why you need a voltage translator, Max232 or SP3203EEY. The output from these devices will be within the 5V range that you can communicate it with other logic devices such as your microcontroller. Since the output from a serial port is in serial you will need a SP converter. It will convert your data to parallel form. This you will have to find out yourself what chip is able to do this. The output of this chip will then be channeled to simple LEDs to show you the display.

RS232(comm Port) Problem
I'm working with machine which connects to comm port. I need to get some data from the machine to computer. machine's manual says need to send the ENQ for data dumping and ACK after receiving.

Please let me know how to send ENQ & ACK command to RS232(comm port)
I'm using MS Comm control in VB6

Can't Open Comm Port *resolved
Morning all,
its early and I haven't finished a cup o' coffee yet so maybe thats the problem. Anyway I have the following code -
Code:

With Me.MSComm1
.Settings = "19200,n,8,1"
.CommPort = 1
If .PortOpen = False Then .PortOpen = True
End With

This code has worked fine for many moons, then suddenly, I get a runtime error 8005, Port alreay open error on the .Portopen = True statement. It doesn't make sense. If the port is open, the code should never try to open it anyway. I have no other portopen statements in the code, and I have checked the port in the device manger and everything looks normal, (it's using the same resources it always has, etc.)
Any suggestions?
thanks
kevin

Copyright © 2005-08 www.BigResource.com, All rights reserved