Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to determine modem comm port number
Message
De
08/01/2001 06:17:26
 
 
À
07/01/2001 22:26:14
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00460387
Message ID:
00460493
Vues:
8
>>I have commtools. It requires a com port number. Does anyone know how to get this from the user's computer without having to have a control file that has to be maintained?
>
>Look in the FAQ - I posted code that will return the identity of all COM ports available to the MSCOMM32 control; you could use that information to then spin through the available COM ports looking for a modem by sending a control sequence and waiting for a possible modem to respond. There's no guarentee that a modem will be available, that it'll be able to get on line, and you need to know the control sequences for the modem; even if a modem responds, there's no certainty that it's connected to a phone line. The code I posted will reliably locate standard COM ports between 1 and 16 at standard addresses. It's extremely likely that if you find a modem on other than COM1-4, it's going to have customized IRQ and IO port identifiers associated with it, especially with PnP PCI or PC Card (CardBus) modems.
>
>You may want to examine the HKEY_LOCAL_MACHINE\Hardware\DEVICEMAP registry hive for information on possible modem devices, whiuch could be in a number of subkeys; the most common one is SERIALCOMM, but others are possible, especially with PC Card/CardBus modems.
>
>If you were not using CommTools, I'd suggest using a TAPI control that handles the issues of identifying available TAPI devices and providing a virtualized interface to the TAPI device, but that might not be what you're looking to do.
>
>In general, writing detailed modem handling in VFP apps is not a very cost-effective approach in most cases; adding a third-party ActiveX control with the required capabilities or accessing another app for the communications such as PCAnywhere32 that has scripting, a high-level view of the comm port, file transfer capabilties and the like is usually a better solution, but it's your app and you've given no indication of what needs to be done.
>
>I have no idea regarding how to do the equivalent using CommTools.
>
>In general, I'd recommend using a configuration file or entries in the registry to specify the modem; you need to know more than just a port ID in the vast majority of cases.

Just a word of warning on polling through serial ports sending out a control sequence - it is possible for there to be other devices attached to serial ports that can get screwed up by unexpected data arriving (I've suffered from this). I'd say that Ed's recommendation of configuration files/registry entries is preferable.
Mike

"I can live with doubt and uncertainty and not knowing. I think it is much more interesting to live not knowing than to have answers that might be wrong." - Richard Feynman
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform