Page 2 of 2 <12
Topic Options
#28151 - 2002-09-12 11:49 PM Re: How Do I locate and use the next available registry value
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
The code by Chris works pretty well, however I ran into a snag in that the MS Office 97 seems to need the
full path added to the name of the custom dictionary and Office 2000 and Office XP don't "seem" to need the path.

Never Mind I found the problem. I was not adding the $Variable+"String" together properly.

[ 13. September 2002, 00:22: Message edited by: NTDOC ]

Top
#28152 - 2002-09-13 02:54 AM Re: How Do I locate and use the next available registry value
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
Does anyone know why this code goes into an endless enumloop on Windows 98, but not on NT/2000/XP

This code works fine on all the NT platforms, but goes into an endless loop with Windows 9x, CTRL-C won't break out of it either, but it will end task or if using DEBUG you can quit it.

code:
Break On
$UpdateCustom=UpdateDictionary()

Function UpdateDictionary()
$HKLMSF = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"
$HKLMSMWCV = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion"
$HKLMAppPaths = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths"
$app = "winword.exe"
$path = readvalue("$HKLMAppPaths\$app","")
$WordVer = val(getfileversion("$path","Productversion"))
$WordVerFull = GetFileVersion("$path","Productversion")
$FileToCopyLocation="\\sm-cag-fp10\logs\"
$FileToCopy="WDICustom.dic"
$Find = "WDICustom.dic"
$EnumRegKey = "HKLM\Software\Microsoft\Shared Tools\Proofing Tools\Custom Dictionaries"

If KeyExist($EnumRegKey)
$Index = 0
Dim $ValueName[100], $ValueData[100]

While @ERROR = 0
$ValueName[$Index] = ENUMVALUE($EnumRegKey, $Index)
$ValueData[$Index] = READVALUE($EnumRegKey, $ValueName[$Index])
If $ValueData[$Index] = $Find $Found = 1 Endif
If @ERROR = 0 $Index = $Index + 1 Endif
If $Index = ubound($ValueName)
ReDim Preserve $ValueName[$Index+100], Preserve $ValueData[$Index+100]
Endif
Loop

$Index = $Index -1
ReDim Preserve $ValueName[$Index], Preserve $ValueData[$Index]

If Not $Found
$nul = WRITEVALUE($EnumRegKey, val($ValueName[ubound($ValueName)])+1, $Find, "REG_SZ")
Endif
Return
Endif
Return
Endfunction


Top
#28153 - 2002-09-13 05:31 AM Re: How Do I locate and use the next available registry value
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Check the code for the ArrayEnumValue UDF. I believe I went according to the documentation checking for a return value of 259 indicating that the last entry has been reached. I just don't really remember anymore.
_________________________
There are two types of vessels, submarines and targets.

Top
#28154 - 2002-09-16 07:50 AM Re: How Do I locate and use the next available registry value
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
Thanks Jens,

I'll take a look at modifying the code and see if that works. The code is currently not checking that, but seems to work fine on NT. Win9x though goes crazy with the current code.

Top
Page 2 of 2 <12


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 809 anonymous users online.
Newest Members
StuTheCoder, M_Moore, BeeEm, min_seow, Audio
17884 Registered Users

Generated in 0.052 seconds in which 0.024 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org