Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21266

Registry key randomly is not found running windows 8

$
0
0
The first time my client runs my VB6 app, they must enter an activation key, which I write into a registry key.

It has worked for years on XP, windows 7, but I have a client that runs Windows 8, and every few weeks when he starts the app, it can't open and query the key. The key is there, but it gets a non-zero return.

Twice I've deleted the key with regedit, and had him restart the app, and it creates the key, and works for a while, then it fails again.

Anybody have any ideas?

Here's how I create the key. It creates the key, but as I said; after a while the query fails.

Code:

Sub SaveValue(hKey As Long, strPath As String, strvalue As String, strData As String)

  Dim ret As Long
  Dim waction As Long
  Dim hNewKey As Long

  'Create a new key
  ret = RegCreateKeyEx(hKey, strPath, 0&, vbNullString, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 0&, hNewKey, waction)
 
  'Save a string to the key
  ret = RegSetValueEx(hNewKey, strvalue, 0, REG_SZ, ByVal strData, Len(strData))
  'close the key
  ret = RegCloseKey(hNewKey)
   
End Sub


Viewing all articles
Browse latest Browse all 21266

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>