Very strange: the code was good for the last 10 years and now it is stumbling!!!
- From: "Jack" <replyto@it>
- Date: Fri, 3 Oct 2008 15:59:32 -0400
Hello,
Maybe someone else had the same problem.
The code writing to Windows registry was good and working perfectly for the
last 10 years and now suddenly it stops working intermittently.
By " intermittently" I mean that when on the first run the code fails (there
is not any error returned, just the registry is not written), the repeated
attempt to run the same code is mostly successful like that sample below:
-----------------------
rtn = OSRegSetValueEx(phkResult, "My Key", 0, 1, ByVal Release,
Len(Release))
rtn = OSRegSetValueEx(phkResult, "My Key", 0, 1, ByVal Release,
Len(Release))
-----------------------
And, that happens on the different user computers in different countries(!),
and it happened (although once only) on my computer, when testing user
complaint (Windows XP)
I appreciate any comments on that.
Jack
Below, is the code in question:
=====================
Declare Function OSRegCreateKey Lib "advapi32" Alias "RegCreateKeyA" (ByVal
hKey As Long, ByVal lpszSubKey As String, phkResult As Long) As Long
Declare Function OSRegSetValueEx Lib "advapi32" Alias "RegSetValueExA"
(ByVal hKey As Long, ByVal lpszValueName As String, ByVal dwReserved As
Long, ByVal fdwType As Long, lpbData As Any, ByVal cbData As Long) As Long
hKey = HKEY_CURRENT_USER
lpszSubKey = "Software\Me\My Software"
rtn = OSRegCreateKey(hKey, lpszSubKey, phkResult)
rtn = OSRegSetValueEx(phkResult, "My Key", 0, 1, ByVal Release,
Len(Release))
=======================
.
- Follow-Ups:
- Prev by Date: Re: Application To Restart Itself
- Next by Date: Re: Very strange: the code was good for the last 10 years and now it is stumbling!!!
- Previous by thread: Search and replace in textfile
- Next by thread: Re: Very strange: the code was good for the last 10 years and now it is stumbling!!!
- Index(es):