Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Trouble with registry class
Message
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00691122
Message ID:
00692039
Vues:
20
I first want to say that I did not write this and I don't want to step on any toes by placing this code here. It is a method in the class (I believe that I downloaded it) that creates an array of sotware that is installed. In this case checking on the local machine in the uninstall section of the registry.

LPARAMETERS aKeyNames
LOCAL nKeyEntry,cNewKey,cbuf,nbuflen,cRetTime, nKeySize, nErrCode
nKeyEntry = 0
DIMENSION aKeyNames[1]
DO WHILE .T.
nKeySize = 0
cNewKey = SPACE(100)
nKeySize = LEN(m.cNewKey)
cbuf=space(100)
nbuflen=len(m.cbuf)
cRetTime=space(100)

the following line is what starts the problem.

m.nErrCode = RegEnumKeyEx(THIS.nCurrentKey,m.nKeyEntry,@cNewKey,@nKeySize,0,@cbuf,@nbuflen,@cRetTime)

When the blank registry entry is found it returns an error code. In this case 259. I stepped through one entry at a time and got to the 69th entry when it hit the blank. It hit the case and skipped to the bottom.

DO CASE
CASE m.nErrCode = ERROR_EOF
EXIT
CASE m.nErrCode # ERROR_SUCCESS
EXIT
ENDCASE

cNewKey = ALLTRIM(m.cNewKey)
cNewKey = LEFT(m.cNewKey,LEN(m.cNewKey)-1)
IF !EMPTY(aKeyNames[1])
DIMENSION aKeyNames[ALEN(aKeyNames)+1]
ENDIF
aKeyNames[ALEN(aKeyNames)] = m.cNewKey
nKeyEntry = m.nKeyEntry + 1
ENDDO

IF m.nErrCode = ERROR_EOF AND m.nKeyEntry # 0
m.nErrCode = ERROR_SUCCESS
ENDIF
RETURN m.nErrCode

After this the array length went from 68 entries to 2 (a start entry and the entry for the record that was .f.) When it was returned to the initial loop it met the exit criteria after one pass and exited as it should have. I have tried to comment out the case statement but that placed me in an endless loop. So I guess now my question is how to code around this and keep going and still keep the results of the array up until that point?

I just remembered where I got started with this class it was discussed in the Jan. 2002 edition of Foxpro Advisor by Tamar E. Granor.

Kelly
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform