Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Registry.prg - CLASS filereg's GetAppPath PROCEDURE
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00661519
Message ID:
00662683
Vues:
31
Yes, the trimming is actually done on the last line of the original GetKeyValue function as follows.
  m.cKeyValue = LEFT(m.lpbData,m.lpcbData-1)
You did correct me... I needed to replace the lnCharReturned variable with m.lpcbData to properly trim the expanded string.
m.lpcbData = ExpandEnvironmentStrings(m.lpbData, @lcExpandedString, 1000)
>Small correction
      lnCharReturned = ExpandEnvironmentStrings(m.lpbData, @lcExpandedString, 1000)
>*      m.lpbData = m.lcExpandedString
>      m.lpbData = LEFT(m.lcExpandedString, lnCharReturned-1)
>You can also use WSH
oShell = CreateObject("WScript.Shell")
>m.lpbData = oShell.ExpandEnvironmentStrings(m.lpbData)
>
>>
>>After a search on MSDN I found the ExpandEnvironmentStrings function.
>>
>>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/sysinfo_4ysz.asp
>>
>>I added the Declare to the LoadRegFuncs procedure
>>
>>  DECLARE LONG ExpandEnvironmentStrings IN Win32API ;
>>    STRING cSrc, STRING @cDst, LONG nSize
>>
>>
>>Modified the GetKeyValue procedure
>>
>>* wrd-bds - 05/27/2002 added code to expand REG_EXPAND_SZ value types
>>  DO CASE
>>    CASE lpdwType = REG_EXPAND_SZ
>>      LOCAL lcExpandedString,lnCharReturned
>>      lcExpandedString = SPACE(1000)
>>      lnCharReturned = ExpandEnvironmentStrings(m.lpbData, @lcExpandedString, 1000)
>>      m.lpbData = m.lcExpandedString
>>
>>    CASE lpdwType # REG_SZ
>>      RETURN ERROR_NONSTR_DATA
>>
>>  ENDCASE
>>
>>* Make sure we have a data string data type
>>*!*      IF lpdwType # REG_SZ
>>*!*        RETURN ERROR_NONSTR_DATA
>>*!*      ENDIF
>>
>>
>>And I am good to go.
>>
Heavy Metal Pedal - click with care
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform