Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do I detect if a modem is present?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Produits tierce partie
Divers
Thread ID:
00114846
Message ID:
00115130
Vues:
10
>>I've got the CommTools comunication library for VFP 5 and I haven't been able to figure out how to determine if a modem is present, available and ready to be used. I don't do a lot of programming in this area (communications), so maybe I'm just not understanding something trivial.
>>
>>I've tried reaching CommTools via e-mail and fax but I've had no success...in fact my emails have been bouncing back, even when I click on their link at their web site. :-(
>>
>>My boss won't let me release my app until I have this test and a graceful way of handling things when the modem is not there or is not ready. If you could give me some help with this I'd appreciate it.
>>
>>Thanks.
>Richard,
>
>While I've never done this, I believe the API provides a way. From hwat I know, you'd use the CreateFile() function to retrieve a handle to the device (COM1:?) then use that as one of the properties to GetCommState(). If you where able to retrieve a handle, or if GetCommState() returned a number other than 0, it would be a good indication that there *may* be a modem present. It could be a serial mouse, for example. However, the members of the structure you pass to GetCommState() should contain enough information to allow you to distinguish between a modem and a mouse.
>
>Alternately, there may be information in the registry. However, I don't know if there would be a registry key that would unfailingly provide this information.

A single registry key, no. You can recursively search the registry subkey HKEY_LOCAL_MACHINE\Enum\SERENUM for a node with a registry value named 'Class' with a REG_SZ value of "MODEM" or "Modem". This node will also contain a registry value "ClassGUID" that contains a REG_SZ GUID for the configuration of the modem. You can then recursively search HKEY_LOCAL_MACHINE\Enum\Root for a node with a matching "ClassGUID"; this node's name will be the device assigned to the modem. From there, you're on your own...
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform