How To Detect How Many Comport, Lpt Port In Pc ??
How to detect com port, lpt port, usb port in PC ???
does any one have the sample code??
thanks for advance
ps: sorry for my english, i'm from Indonesia
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
How To Detect Comport In Vb 6
com port changes in every comp if we attaches USB Serial port so i want to detect comport. please give me code in vb
Extend ComPort (Serial Port) To 256
Recently I'm doing a project that need to be communicated with maximum 256 Serial Port. However vb MSComm control only offer communication up to 16 port. Does anyone know a way to solve this probelm?
Serial Port Detect
Found this comport detect code on the forum, but for some reason I get runtime error '8002' Invalid port number, when I should get the 'no available comm ports' message.
On Error GoTo 0 should switch off error reporting ?
Dim i As Long
Dim nComm As Long
nComm = 0
For i = 1 To 4
MSComm1.CommPort = i
MSComm1.PortOpen = True
If MSComm1.PortOpen Then
nComm = i
On Error GoTo 0
If nComm = 0 Then
Err.Raise 10001, , "No available comm ports."
MsgBox "Opened Comm " & nComm
Using Serial Port To Detect Something.
Hey all I am in need of some help figuring out the best way to go about this idea of mine.
I would like to hook up a serial port to a car's backup lights. The reason being is to detect if the car is in reverse. I want the computer to switch to the webcam and display it on the LCD. Once the car is out of reverse I would like it to stop the webcam and continue with the other program on the LCD.
Problem is that I donít know how to detect that using the serial port. Is there a way to check with a timer for some current or a ground from the backup lights when they come on and send a signal to the serial port that they are on? And then do the same thing once they are off?
If anyone has any demos or sites they could share then please do.
Software To Detect Port 25?
Does anybody know where can I download a software that can check if port 25 on any server is available for SMTP?
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.
Detect A Signal On My Com-port
Can somebody help me with the next stuff?
I've an app. in the system tray and if I push the F11 button, then the app. starts. Now I will change the F11 button to a signal on my com2 port.
Does somebody knows how I can detect the signal on my com port and how I can start then the program in the system tray?
Br. Peter B.
How VB6 Can Detect SERIAL PORT
Can anybody help me how to detect Serial Port ( Com 2), because I have a digital WEIGHING MACHINE where it connected to PC serial port. I want the data which sent by the weighing machine to be display through a text box in the form. Any help will be highly appreciated. Thank you..
Detect If Port Is Open
How can I detect if a certin port is open on a network?
I want to check it before I try to use it.. Save some time and agravayion..
Detect Modem Port?
Is there any way to automatically detect which port contains the modem?
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$
Status = Temp$
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
'' 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
.PortOpen = False
Debug.Print "On COM:" & vbCOMS.CommPort & " error: " & Err.Number & " : " & Err.Description
If (vbCOMS.PortOpen) Then vbCOMS.PortOpen = False
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
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.
<Open "LPT" for ...> is not reliable and causes program to halt.
Detect Mouse/KB Port
Hi, I'd like to detect which port is using the mouse in the local machine, as well as the keyboard. The main idea is to verify whether they are connected (what can be done with the Connnections control or the Winsock control), but first I need to know where to "ask"...
Any idea? Thanks
How To Detect If Data Is Changed From A Com Port ??
How do I detect if the Com port recieves any kind of information ?
I want to make a program that checks if any data is recieved to that Com Port, and when data is recieved it does some stuff.
Please help me....
Detect Parallel Port Addresses
Need help with detection of parallel port addresses. There's a sample program, NTPORT Library, but it will only detect the on board parallel port. I'm using an auxiliary PCI duplex parallel port card, as will most all that use my program, and auto detection would be very convenient.
Detect USB Cable Connected To USB Port???
Is there any method by which i can find out if a USB cable is connected to USB port through VB program. It would of great help if someone can guide me with this.
Thanx in advance,
Detect Parallel Port Address And Mode
I'd like to be able to read the parallel port address and mode from vb 6.0 and ideally I would like to be able to change the mode to ECP if it not already in that mode.
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.
Using The LPT1 Port To Detect Any Kind Of Printer Input
I have a problem actually accessing the LPT1 printer port under WinXP. I know how to use the MSCOMM1 control for serial COM ports but is there any kind of equivelant out there for the parallel port.
I only need to capture a single event change on the port, (basically telling the user there is feedback from the port as an incoming event) and thought that something like the comEVReceive event might be available.
I don't want to use any excess dll files in the program but i guess i'm just about ready to try anything at this stage guys.
thanks in advance for any help i might recieve...
Comport To Udp
i need the code for sending the data from a comport to udp.
i have an aplication that listens to udp.
the data is ascii strings (nmea)
the udp portnumber and ipadres off the remote computer needs to be selectable.
does anyone have something like that?
or maybe someone can give me a push in the right direction.
it would be very nice iff the comport is still available for other aplications.
sort off comport cloning
I am using an USB to serial dongle which is creating a virtual serial port COM4.But unfortunately VB6 does not recognize COMPORT no. more than 2......the following snippet generates an error at the highlighted line(Accepts only 1/2):
.Settings = "9600,n,8,4"
.Handshaking = comRTS
.RThreshold = 1
.RTSEnable = True
.SThreshold = 0
.InputLen = 0
One solution can be to change the port no. to 1 under device manager/ports....but this is not possible since COM1 is already existing & is being used fore another purpose.
What's the workaround?
anyone got any sample codes using the comm control etc.
I need this for a colleague of mine
Comport In DLL
I want to produce an ActiveX DLL.
I want the DLL to contain a comport module.
I want to set the comport parameters from within the DLL.
How do I attach the comport to the DLL?
can any one tell me how to configure the comport with V.B.
I have posted this question several times but no one has replied yet.Can anyone can help me soon because I am working on a project in V.B which requires configuring the com port.I thank anyone who helps me.kindly send me the coding also.
I want to create a search box in V.B which resembles the one like the find box of our desktop.tell me how to find the files i wish.I thank anyone who helps me.I am sorry to ask for the coding also because I am the person who has just started to work in V.B based projects.
anyone with the answer can reach me at:email@example.com
I need a help, finding which are the Com Port are using by some otherapplication and free. i am able to find the available com port in acomputer. But, i can't able to find its free or not.
Any body can help to solve this situation
To have a list with available comports is handy to complete an installation. The installer allows you to select a device in the example
usb as com6 or the common serial1 as com1.
There are two ways the on error to find available comports
second using the registry.
the last one is a real pain running from key to key to collect the ports and there specifications.
Is there a better way of collecting/ creating a list with comports?
Comport Or Ethernet?
I am programming a software for a hardware interfaced using either the comport or the ethernet.
I am now specifying in my software whether the harware device has to be connected using comport or the ethernet and then i am clicking on connect button to connect to the machine. And if the software finds that the machine is not connected with the specified connection then it gives an error message.
But what i want to do is.... When i click on Connect Machine button, then my software should automatically search for, which connection the machine is being connected and then connect using that perticular connection. How can i do this?
Please help with this query.....
Remember The Last ComPort Used ?
I have a small RS232 program that run well , but I would like when the user have make a choice : COM1 ; COM2 ; COM3 ; etc , that the next time he or she is using this program the same port is used again.
Can I do this in the registry and if yes how ?
Thank you for your help
is this correct? i want to select com1,com2,com3,com4 but im am having problem..
select case combo1 case com1MSComm1.CommPort = 1case com2MSComm1.CommPort = 2case com3MSComm1.CommPort = 3case com4MSComm1.CommPort = 4 end select
Accessing COMPort Under XP?!
A while ago I wrote a couple of data logger apps using the COM-Port via MSCOMM.OCX (VB6). Running fine w/ 98, ME, 2000. Now MSCOMM obviously isn't running under XP. Anyone knows of an updated version of MSCOMM from MS, in a Service Pack or otherwise? Since I'm on a dial-in connection I don't feel like downloading Service Packs by the dozen just for the fun of it only to see it won't help.
I seem to remember there was an example out there for accessing the COM-Port via API-calls with no need for the OCX, but I can't find it anymore. Could somebody point me into the right direction?
Many thanks in asvance and Happy New Year!
Communicating With A Comport
I'm new to VB, but I've been asked to write a system which communicates with an external projector attached to a comport.
The system has to mirror a remote control (they want to control the projector from a computer rather than a hand held remote) the codes that the system recognizes are hex values. For instance the string "BE EF 03 06 00 F1 72 02 00 01 22 00 00" would power the unit up.
The first three strings are header info, the next two are function, etc.
Does anyone have any suggestions on how I might do this or any examples of systems that do a similiar job.
Thanks for your help
Hello,I am trying to translate a thermal analysis program written in Turbo Basic into VB. The basic testprogram runs very well under TB. My "translated"program in VB,running on the same computer and attached hardware, however, does not work at all.
I must be making some fundamentally wrong mistakes. Both example programs are given below and I would appreciate it very much if somebody could give me the nescessary changes that are needed.
''Working test program in Turbo basic:
''Open "com2:9600,N,8,1,RS,CS,CD,DS" For Random As #1
''cmd$ = "%01020F0600"
''Print #1, cmd$
''locate 3, 10: Print "pres enter to start";
''If trs$ = "n" Then End
''locate 5, 10: Print temp
''cmd$ = "#022"
''Print #1, cmd$
''temp$ = Input$(9, #1)
''temp$ = Mid$(temp$, 3, 6)
''temp = 10 * Val(temp$)
''locate 5, 10: Print temp
''Test program in VB:
Private Sub Command1_Click()
MSComm1.Output = "%01020F0600"
For i = 1 To 100
MSComm1.Output = "$022"
dummy = DoEvents()
Text1.Text = Val(MSComm1.Input)
Private Sub Option1_Click()
MSComm1.PortOpen = True
MSComm1.Output = "%01020F0600"
Private Sub Option2_Click()
MSComm1.PortOpen = False
Thank you in advance, Cees van de Velde
Sorry if I've posted the following question in the wrong forum:
I have developed an application and have an API call to find out which comport value the hardware is using. For example, when I plug in the usbport, the API call retrieves comport value of 6.
What I'm not sure about is why when I run my app, it already has values that are already triggered on.
If the api call has just picked up the virtual comport value then shouldn't all the values be turned off when I run my app?
Get Data From Comport Help ?
I collect a Section code get data from rs232 ( commport )
but it not work ! error Byref argurment type mismatch
Can you help me fix it ?
Thank verymuch !
The codes follows:
Public PrepareLog as Boolean
Private Static Sub MSComm1_OnComm()
Select Case MSComm1.CommEvent
' Event messages.
Dim buffer As Variant
buffer = MSComm1.Input
' Eliminate transferring signal from screen.
SignalString$ = Chr$(8) & Chr$(32) & Chr$(8) 'the unwnated control signal of the device
For i = 1 To Len(buffer)
If i = InStr(buffer, SignalString$) Then
buffer = Left$(buffer, i - 1) & Mid$(buffer, i + 3)
'provide onscreen realtime signal respond on a textbox "txtTerminal"
txtTerminal.Text = txtTerminal.Text & buffer
txtTerminal.SelStart = Len(txtTerminal.Text)
'write the file to record the process
PrintLog buffer, filelognum
txtTerminal.SelStart = Len(txtTerminal.Text)
Public Sub PrintLog(PrintString As String, FileNo As Integer)
If PrepareLog = False Then Form_Initialize
Dim length As Long
length = LOF(filenum)
Put #FileNo, length + 1, PrintString
Private Sub Form_Initialize()
start = Now
PrepareLog = True
filelognum = FreeFile
PrintLog "This file record down all the comm-port activities that carried out by the host.", filelognum
PrintLog "Written by Antony Leung.", filelognum
PrintLog "********************************************************************************", filelognum
PrintLog "Application:" + App.EXEName + ".exe", filelognum
PrintLog "Working path:" + App.Path, filelognum
PrintLog "Login Time:" + Format(start), filelognum
PrintLog "", filelognum
Public Sub OpenLog()
Open App.Path & "filename.extension" For Binary As #filelognum 'your record file goes here
Cannot Receive From ComPort
I have an application that use a PDA to download information from a mobile using infra red port.
I use Microsoft CE Comm Control 3.0 (included in eVB kit).
I use COM3, ie CommPort = 3,
I can send command to the mobile, ie I can ComPort.Output = 'ATD123456' + Chr(13)
I cannot receive response from the mobile, ie. OK, BUSY, NOT CARRIER, etc.
I use onComm event, and cannot see any comEVReceive, or comEVCTS event?
Do I need to set something?
Currently, I have DTREnable = True
Handshaking = 2 - COMRTS
InputLEN = 0, = 1, = 999 (Tested lot of value)
NullDiscard = False
RThreshold = 0, = 1
RTSENable = True
Settings = 9600,n,8,1 , = 115200,n,8,1 = 1200,n,8,1
SThreashold = 1
People told that the control have problem, if it is true, what can I do?, Using CreateFILE?
Redirect A Comport
Hello all of ya,
I'm wondering if there's away in vb to redirect a comport.
Im having a program thats looking for com1 or com2.
But i'm running this software on a laptop with just an usb port. So now I have bouhgt a serial pcmcia seriel card, but that puts his ports on com4. Is there anyone who can tell me if I can create a program that redirect my com4 to com1? Or is there another way to do the job?
Thanks a lot allready for your reply's on this one.
Thanks to Michael Vlastos for confirming what I suspected , that one cannot open the comport using MSComm1 when using the learning edition of VB. Now to backup that question. Are there any other objects available to do this or is any code available to do this. We do not need dialing ability, just in - out capability. 73 RSH
Comport Loggers And Sniffers
When designing a VB app, is it possible to lock the comport to the VB app and prevent any other apps on the computer from using that specific port?
Communicating With A Comport Device Over A LAN
I'm just investigating a problem at the moment and wondered if anyone could shed some light on it.
I have written some programs that mirror the functions of a remote control for various projectors attached to a PC via the comports.
RS232 and to some extent RS485 have cabling limitations and I've now been asked if the programs would still work if the projectors were attached to a LAN with a piece of hardware like a Lantronix's MSS100 which has TCP/IP in one side and RS232 out the other.
I've asked for the hardware so I can begin testing, but I'd be interested to know if anyone has experience of this and any potential pitfalls.
Sending Data To ComPort
I have never worked with the Com port in VB before, and would really like to know how, how to set it up for sending, and how to make it send the ascii-codes for the text in a textbox..
- Thediabloman -
Send Hex Data Through To The Comport
I have an external projector attached to comport 2, the data it's expecting is a hex string (for instance
BE EF 03 06 00 2A D3 01 00 00 60 00 00 switches it off) I've got a very basic form to send data to the comport after it's configured correctly, but how do I tell the comport that the data is HEX
Any help would be appreciated
Sending AT-commands To ComPort
It is probably possible to send custom commands to a ComPort i.e. Com 1 but how??
The reason I'm asking is because i would like to code a program for my Siemens C35i... I have finally received the codes form Siemens, but I don't have a clue how to send them to the telephone...
The telephone is connected to the computer via a cable connected to the Com port!!!!
Thanks in advance
Problem Accessing Comport
Task :- Transfer data from a Pentium with windows XP to a FANUC controller for an AMADA metal punching machine.
Currently, we are using a QB program on a 486 with win98 using the following command structure to access the comport.
shell "mode com2: 2400,e,7,2,p"
shell "type " + filename$ + ">com2"
The above commands also work in a batch file.
However, this does not work on a Pentium with either win98 (DOS mode) or XP. A write fault error writing device com2 occurs.
So I tried using the Quick Basic command -
OPEN "com2: 2400,e,7,2,asc,cd0,cs0,ds0,op0,rs" for output as #2
Then I tried the Visual Basic command -
MSComm1.CommPort = 2
MSComm1.Settings = "2400,e,7,2"
MSComm1.PortOpen = True
MSComm1.Output = A$
I need to know what to add to my VB code to make the above work.
The above settings are required for the FANUC.
Both of these methods transfer data from Pentium to Pentium using a null modem cable
But neither works when connected to the FANUC controller using their special cable.
The pin are 1fg 2sd 3rd 4rs 5cs 6dr 7sg 8cd 20er 25+24n
The cable has been tested by the FANUC agent using their own DOS based program on our Pentium running win98 (DOS mode)
Their program is not user friendly enough for us and although there are programs available on the net, again they do not suit our needs.
I have also tried booting to a DOS 6 floppy with no success.
I would be very grateful for any assistance,
Thanking you in anticipation,
Make A Pulsing Signal On Comport
I'm trying very hard to make a timer that wil generate a pulse of 1ms, 1,5ms, and 2ms on my comport (dtr and rts). With this I mean that a pulsing signal is present on the DTR and/or RTS pins of the port.
I've tried a for/next loop but once this is started I can't get out without using CTRL+BREAK.
I noticed a timer in VB 6.0 but I don't know how to use it, maybey some of you have tried stuff like this before, I'd like some tips.
The purpose of this is to drive servomotors (as used in RC Cars/planes/boats) so I can make my webcam (which is mounted on a pan/tilt platform driven by these servos) move around the room.
The servomotors need a pulse between 1 and 2 ms to go from full left (1ms) to full right (2ms) or 1,5ms to center.
Any help is welcome.