Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Retrieval of icons associated with files/applications
Message
 
To
14/08/2001 01:32:45
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00542621
Message ID:
00543440
Views:
18
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform