Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Detecting Soundcard
Message
 
À
15/12/1999 08:47:11
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00303988
Message ID:
00304003
Vues:
30
>I'm trying to use Registry.vcx from the file section to detect whether a soundcard is installed on a given system, to allow me to play a wave file during heads-down data entry. I looked at the HKey_Local_Machine hive and located a soundcard using the following code snipet:
>
>#DEFINE HKEY_LOCAL_MACHINE -2147483646
>#define key_wave_msinfo "system\currentcontrolset\control\mediaresources\Wave\"
>
>set classlib to "c:\winreuse\v1.0\classes\registry.vcx"
>
>lcSomedata = ""
>oReg = CreateObject("Registry")
>lnError = oReg.GetRegKey("",@lcsomedata,KEY_WAVE_MSINFO,HKEY_LOCAL_MACHINE)
>
>lcSomeData returns "Audio"; lnError = 0
>
>if I use the following instruction:
>oReg.GetRegKey("driver",@lcsomedata,KEY_WAVE_MSINFO,HKEY_LOCAL_MACHINE)
>
>lcSomeData returns ""; lnError = 2
>
>if I use the following code:
>#define key_wave_msinfo "system\currentcontrolset\control\mediaresources\Wave\es1869.drv<0001>"
>oReg.GetRegKey("driver",@lcsomedata,KEY_WAVE_MSINFO,HKEY_LOCAL_MACHINE)
>
>lcSomeData returns "es1869.drv"; lnError = 0
>
>In RegEdit, there is a folder shown below Wave which on 1 machine is es1869 and on another sb16????? with pertinent info available.
>
>On a Win98 system without a soundcard, there is NO folder below Wave.
>
>My question, is "How can I return the name of the folder below \WAVE"?
>
>TIA

Mike,

Use the classes EnumKeys function passing it an array like this:
#DEFINE HKEY_LOCAL_MACHINE -2147483646 
#DEFINE KEY_WAVE_MSINFO "system\currentcontrolset\control\mediaresources\Wave\"
SET CLASSLIB TO REGISTRY.VCX
oReg = CREATEOBJECT('Registry')
RELEASE CLASSLIB REGISTRY.VCX
DIMENSION a_keys[1]
lnerror = oReg.OpenKey(KEY_WAVE_MSINFO, HKEY_LOCAL_MACHINE)
IF lnerror = 0
  lnerror = oReg.EnumKeys(@a_keys)
  IF lnerror = 0
    FOR lni = 1 TO ALEN(a_keys, 1)
      ? a_keys[lni]
    NEXT
  ENDIF
  oReg.CloseKey
ENDIF
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform