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