Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Retrieval of icons associated with files/applications
Message
 
À
14/08/2001 01:32:45
Dennis Little
Ist Choice Travel
Glos, Royaume Uni
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00542621
Message ID:
00543440
Vues:
28
>George
>
>Apologies - I did not explain myself properly.
>
>If you run the code as is, an error occurs as "lcValue" has no value.
>
>The question really is what other information do you need to add to the code to get it to run?
>
Dennis,

There's a typo and the omission of the declaration of lcvalue prior to its being passed. Here's the corrected version:
SET CLASSLIB TO REGISTRY.VCX ADDITIVE && Registry class from the FFC
oReg = CREATEOBJECT('Registry')
lnresult = oReg.OpenKey(".doc") && open for Word
IF lnresult = 0
  STORE "" TO lckey, lciconpath, lcvalue
  lnresult = oReg.GetKeyValue("", @lcvalue)
  IF lnresult = 0
    ? lcvalue
    oReg.CloseKey
    lcvalue = ADDBS(lcvalue) + "DefaultIcon"
    lnresult = oReg.OpenKey(lcvalue)
    IF lnresult = 0
      lnresult = oReg.GetKeyValue("", @lciconpath) && get the icon
      ? lciconpath
      oReg.CloseKey
    ENDIF
  ENDIF
  oReg.CloseKey
ENDIF
The basic premise, however, works. I tested it on both a Win98SE box and under Win2K. The variable must be passed by reference (the reason for the @) in both calls to GetKeyValue. If lcvalue is empty on return, it means that there's no default value associated with the extension. In this case, Windows uses a default icon for display purposes.

You can check the default value by using the Registry Editor (REGEDIT.EXE) in all flavors of Windows.
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