Click to See Complete Forum and Search --> : Get Number Of COM Ports
September 15th, 1999, 10:11 PM
Hi,
How can I know dynamically how many COM Ports are attached to the System. Is there any API through which I can achieve This..
Pl. Let me Know
Regards
Madhav
Miguel
September 16th, 1999, 02:43 AM
Hi:
You can get this information reading the Windows registry file.
The information, that you are looking for is in:
HKEY_LOCAL_MACHINE\hardware\devicemap\SerialComm
For reading the Windows registry file you can use the following functios:
RegOpenKeyEx, RegQueryValueEx and RegCloseKey
I hope that this information will be useful for you
Good Luck, Bye....
Lior
September 16th, 1999, 05:14 AM
Hi Miguel,
I would like to know if these functions are API and if yes what parameters do they have or what constants do they have??
Thank-you!!
LED
September 16th, 1999, 11:12 AM
Hi Lior:
These functions are API and following you can see the declarations in your Visual Basic program.
private Declare Function RegCloseKey Lib "advapi32.dll" (byval hKey as Long) as Long
private Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (byval hKey as Long, byval lpValueName as string, byval lpReserved as Long, lpType as Long, lpData as Any, lpcbData as Long) as Long
private Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (byval hKey as Long, byval lpSubKey as string, byval ulOptions as Long, byval samDesired as Long, phkResult as Long) as Long
Anyway you can find information about these functions in the Visual Studio help file. If you have any problem, donīt doubt to contact with me.
Good luck, bye....
Miguel
September 16th, 1999, 11:29 AM
Hi Lior:
I donīt know if you have received my post fine, for this reason I replay again
These functions are API and following you can see the declarations in your Visual Basic program.
private Declare Function RegCloseKey Lib "advapi32.dll" (byval hKey as Long) as Long
private Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (byval hKey as Long, byval lpValueName as string, byval lpReserved as Long, lpType as Long, lpData as Any, lpcbData as Long) as Long
private Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (byval hKey as Long, byval lpSubKey as string, byval ulOptions as Long, byval samDesired as Long, phkResult as Long) as Long
Anyway you can find information about these functions in the Visual Studio help file. If you have any problem, donīt doubt to contact with me.
Good luck, bye....
Miguel
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.