|
-
September 15th, 1999, 10:11 PM
#1
Get Number Of COM Ports
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
-
September 16th, 1999, 02:43 AM
#2
Re: Get Number Of COM Ports
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....
-
September 16th, 1999, 05:14 AM
#3
Re: Get Number Of COM Ports
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
#4
Re: Get Number Of COM Ports
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....
-
September 16th, 1999, 11:29 AM
#5
Re: Get Number Of COM Ports
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|