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

Detect USB Cable Connected To USB Port???

Hi all,

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,

View Complete Forum Thread with Replies

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

Any ideas?

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.


USB Cable Connected Or Not
is it possable to know the usb port is connected with web cam or not? how to know when someone disconnected the usb cable?

Is Netzwork-cable Connected?
Hi @ll,
is there a possibilty to find out, if the the network-cable is connect to de network-card? (Win2k) I have found the API Funtcion "IsNetworkAlive". But this function returns also true, when the network-cable is not connect. It returns only false, when I deactivate the network-connection. Please help me!!

Detecting If Connected Online If Using Cable Modem
I have found some code that allows me to determine if an internet connection is found but my problem is that I have to using a dialup modem in order for it to detect if a connection is true.

Does anyone know if there is code that detects is a user has a cable modem and is connected?

Here is the code I found for checking connection:
Public Function IsConnected() As Boolean
' Code that checks to see if connected to the
' internet.
Dim TRasCon(255) As RASCONN95
Dim lg As Long
Dim lpcon As Long
Dim RetVal As Long
TRasCon(0).dwSize = 412
lg = 256 * TRasCon(0).dwSize
RetVal = RasEnumConnections(TRasCon(0), lg, lpcon)
If RetVal <> 0 Then
MsgBox "ERROR"
Exit Function
End If
Tstatus.dwSize = 160
RetVal = RasGetConnectStatus(TRasCon(0).hRasCon, Tstatus)
If Tstatus.RasConnState = &H2000 Then
IsConnected = True
IsConnected = False
End If

End Function

Detect Disconnected Rs232 Cable
My PC is connected to some device that sends data to me via RS232. The connection always drop out physically (someone kick the cable)... is there a way to detect that?

How To Detect Network Cable Is Unplug
Anyone knows how to detect the network cable is unplug or plug in? Please help....thank you.

Com Port And Null Modem Cable
Do I need any types of Drivers to be installed when I connect two computers at the com port using a Nul Modem Cable.
I tried sending data form the vb application on one machine and tried to capture the text message in the Hyperterminal of Another machine using a Null modem cable which connetcs the com ports of both the machines..

but i'm not able to receive the test message on the Hyperterminal of the second machine..
kinldy advice...

Detect If Connected To The Internet
was wondering if there is some reliable code that can detect if a user is connected to the internet.

Detect All Computer IP Address Connected To LAN
Hi all, i want to ask how to detect ip address of the computers that are connected to LAN. Thanks

Friends, How To Detect A System's Configuration That Is Connected In LAN ?
 Dear Forum Friends,

I Really Need To Know IN VB 6.0, How To Detect The Systems That Are

Conected To LAN And Take Out Their Configuration. (i.e),

What ever systems that are conected to LAN (Switched On), the program has

to detect them and give it's configuration(CPU, RAM, HDD, MainBoard, On Board

Cards, Monitor, KeyBoard, Mouse, Connected Printer Scanner, etc).

My Idea :-

The Connected Systems May Be Gathered In A Combo Box (System Names).

If a Name is Selected The Respective Configuration is to Be Displyed In The Text Boxes.

And That Has To Be Saved In The Data Base.

Dear Friends Help Me.

Please Help Me With Coding also, As I Have To Complete This in one month

Thank U

U'r Sincerely


How To Detect Internet Connection In A Computer Connected To Net Via Lan
Iam working on a project in visual basic in which the
application check wheather there is an active internet
connection or not in every second.

For this purpose I have tried out several options. But
none of this is working. The software is designed to
work in windows NT environment and this software is
installed in every client machines. The client machine
is connected to internet through LAN that is we get
internet connection in an internet server and from there
it is connected to a hub and from the hub all the machines
are sharing the net.

I have tried out the API InternetGetConnectedState of windows.
It works well with machines connected directly to net via modem.
I tried out this API with each of the parameters that is INTERNET_CONNECTION_MODEM ,INTERNET_CONNECTION_LAN ,INTERNET_CONNECTION_PROXY but it is always returning true.

Another method I found is checking the value in the registry sub key
SystemCurrentControlSetServicesRemoteAccess in the key HKEY_LOCAL_MACHINE. It is also returning true every time.

None of these methods are working for machines that is connected
to internet via LAN.

There are some working methods. One method is to use the ping
method to send a signal to a valid address and checking its
returned value. Again the sever (ip address) should be up and
this method takes a alot time nearly 40 seconds. During this
time the system is hanging.
Another method is using the inet control in visual basic.
Connecting this control to server and checking its
state(status) works almost fine. Here again it takes a lot
of resource (time) and is not efficient.

Sir, can you provide me some hint (idea) on how to detect the
internet connection in a computer without minding how it is connected
to the net because when we distribute a software we cannot
predit on
how the user will be connected to the net.
Is there any part of the registry where some modification will take
place. Or is there any other way. Please provide me the information.

Thanking you
Liju John

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?

How To Find Bluetooth Is Connected With Which Com Port Usning Vb6.
hi to all
plz any one kn...
how to find bluetooth is connected with which com port.
and code should be in vb 6.
please let me kn asap...

thanks in adv,,,,,]
viral shah

Controlling Camera Connected In USB Port????Pl. Help Me Out! (urgent)
Hi all,

Can anyone suggest me the solution how to control(on and off) the camera for some alarm conditions connected in USB port using visual basic 6.0? Please help me out in finding the solution for this!


How To Open A Money Box Connected In Serial Port
I'm trying to open a box money using a serial port connection. żAny body have some routine to make it?
Usually the port connections for this kind of boxes is paralel. This case has been resolved. The situation is when I tray using a serial port (COM1).

How To Check If A Comm Port Have Connected With A Device?
How to check if a comm port have connected with a device?

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

How To Read Data From An Irda Receiver Connected To A Usb Port?
Hi all, I want to read data from an irda device wich is connected to a usb port. I used the MSComm control, and successfully read data from COM1 and COM2, but as it seems this control doesn't work with the USB ports. Does anyone have any idea if there is any control for just IR function or USB port communication?

Detect What Is Using Com Port.
Can this be done, when a com port shows to be in use, can you alert the user as to what currently has it occupied?

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
Exit For
End If

On Error GoTo 0

If nComm = 0 Then
Err.Raise 10001, , "No available comm ports."
MsgBox "Opened Comm " & nComm

End If

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
Hallo Hi...
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$
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
Next cnt
End With

Exit Sub

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

Detect Com Port Mouse Is On....
Is there a way I can let an app detect what com port the mouse is on ??

How To Detect How Many Comport, Lpt Port In Pc ??
Hi all,

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

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 The Port Attached By MOUSE ???
By GetSystemMetrics(MS_MOUSEPRESENT), I can detect if
MOUSE present. But how to get the port messages using by MOUSE,
COM1?? COM2?? even in PS2 port??

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 Modem Comm Port
anyone who knows how to detect an internal and/or external modem comm port?

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

Thanks. Michael

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

Want To Know That Connected With Internet Or Not From A LAN Connected Computer
I have 3 computer which are LAN connected I use Internet. I want to make such a program which can detect that is any of my computers are connected with internet or not. If I am using internet from a LAN connected computer still it can know that is any one of my computer is connected to internet or not. Please help me.

hi there! does anyone know how to detect vb to a dlr-3p cable to a comm1 pc port? pls...I need this bad!

Connecting 2 PC's With Serial Cable
I have one laptop running WinXP using a USB to serial port converter and the other laptop running Win98 with a standard serial port.

I have a loopback plug and the software to test it with VB6 and it works fine on both machines. The cables/connections/ports all appear to be working correctly.

I want one machine to send data to the other, but I am not doing something right. I have 2 programs in VB6, one to send, one to receive.

Does anyone see any obvious code problems? This is driving me crazy!

Thanks for any help, I have gone through the FAQ's and all and I still can't find what I am doing wrong.

'Sending End
Option Explicit

Dim OutBuffer As String

Private Sub Form_Load()
With MSComm1
.CommPort = 4
.Handshaking = comNone
.RThreshold = 1
.InputLen = 0
.Settings = "9600,n,8,1"
.SThreshold = 1
End With
OutBuffer = "Hello this is a long string!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" & _
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" & _
End Sub

Private Sub cmdClose_Click()
If MSComm1.PortOpen = True Then MSComm1.PortOpen = False
End Sub

Private Sub cmdOpen_Click()
If MSComm1.PortOpen = False Then MSComm1.PortOpen = True
End Sub

Private Sub cmdTx_Click() 'transmit cmd button
MSComm1.Output = OutBuffer
End Sub

'Receiving end
Option Explicit

Dim Buffer As String 'receive buffer

Private Sub Form_Load()
With MSComm1
.CommPort = 1
.Handshaking = comNone
.RThreshold = 1
.InputLen = 0
.Settings = "9600,n,8,1"
.SThreshold = 1
End With
End Sub

Private Sub cmdClose_Click()
If MSComm1.PortOpen = True Then MSComm1.PortOpen = False
End Sub

Private Sub cmdOpen_Click()
If MSComm1.PortOpen = False Then MSComm1.PortOpen = True
End Sub

Private Sub MSComm1_OnComm()
If MSComm1.CommEvent = comEvReceive Then
Buffer = Buffer & MSComm1.Input
Call HandleInput
End If
End Sub

Private Sub HandleInput()
txtRx.SelStart = Len(txtRx.Text)
txtRx.SelText = Buffer
Buffer = ""
End Sub
ANY ideas would be greatly appreciated.

Thank you!

Reseting A Cable Modem?
Does anyone know how i could reset my cable modem with visual basic. I have a Scientific Atlanta webstar DPX100 Cable Modem and its run via USB port to my computer. having problems with my modem keep stopping so im trying to make something that will somehow reset the connection every 30 mins or something so i can download over night without it disconnecting.

Any help will be appreciated, thanx.

Cable TV Advertisement Software.
Hi all,
I've to develop a program which will show the advertisement on the Cable (as all of u knows it very well). Actually I don't have any Idea on this Topic. My Customer told me that they redirects all the output from PC Screen to Cable. Firstly I thought to make a Form or something in the bottom and sends put ads from database and scroll them. But what about gif's movie clips or animated files or how to join them. Had someone develop any such a thing. Please Help.

Ravikant Y. Ninave

Getting Files Through Parallel Cable???
If two computers are networked with a parallel cable is there a way to get files from one of them from VB, or would the computers have to be networked with a network card???

Direct (cable) Communication
Can you write apps for a direct (parallel) cable communication say, from one laptop to another, by means of the winsock control... or is it exclusively for TCP-IP? If so, what other (third party?) control or way around is available?

Hacking Cable Modems?
Hi guys, well I know that I shouldn't post this in the General section, but most of the people are here, so....
I just want to know if it is possible to change the internet speed (using a cable modem), without opening the cable modem and through the use of software

Someone told me that the ISP sends a data to the cable modem that tells it to set the internet speed is that right or what?

I'm not looking for a way to hack/crack my cable modem, I just want to know if it is possible to modify the speed by software and whether that thing about the ISP is right or not


Linksys Cable Dsl Router
has anyone ever played with the linksys cable/dsl router I have one and I want to build an app that releases the ip and renews it
the admin of the router is an html page and has two command buttons one labeled "DHCP Release"and one "DHCP Renew" basicaly all I have to do is navigate to the page with a browser control and click the release button then wait for the page to refresh then click renew

has anyone ever done something like this before?

Direct Cable Connection
How do I detect if there is a direct cable connection present?

Also, how do I 'dial?' a dcc connection automatically - without the box which you have to type in hostcomp etc. Is it parameters I have to add???

Copyright © 2005-08, All rights reserved