Access Registry Windows 7 (1 Viewer)

niak32

Registered User.
Local time
Tomorrow, 07:04
Joined
Nov 1, 2008
Messages
28
Hi again,

I have a database that writes to the registry in Windows XP but doesn't in Windows 7 (works with Server 2003 as well).

Below is an extract of the code I am using, but it doesnt' work with Windows 7.
Any help would be appreciated.
Oh, and yes, the keys are already there as I have a batch file to add all the structure beforehand
Code:
Private Sub Command1_Click() 'test button for now
 
  myRegKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Niak32Software\timer\\TimerNewName"
  If myRegKey = "" Then Exit Sub 'this is the registry key I want to modify
      
    
    myValue = "test" 'test line to bypass all the testing it normally does
    
    If myValue <> "" Then
      RegKeySave myRegKey, myValue 
    End If
  
 
    Dim stAppName As String
 
    'at this point I check the registry and nothing is there under Windows 7
End Sub

Sub RegKeySave(i_RegKey As String, _
               i_Value As String, _
      Optional i_Type As String = "REG_SZ")
Dim myWS As Object
  'access Windows scripting
  Set myWS = CreateObject("WScript.Shell")
  'write registry key
  myWS.RegWrite i_RegKey, i_Value, i_Type
End Sub
 

smig

Registered User.
Local time
Tomorrow, 00:04
Joined
Nov 25, 2009
Messages
2,209
not sure why you use this to write to the registery.
use the Access built in SaveSetting/GetSetting functions
I never tried it under Win7 but I guess it will work.
 

SOS

Registered Lunatic
Local time
Today, 14:04
Joined
Aug 27, 2008
Messages
3,517
Windows Vista and Windows 7 are a bit more particular about letting things write to the registry. Your program will need elevated permissions to do this.

Do a web search on Windows 7 elevated permissions to see how you will need to approach this.
 

niak32

Registered User.
Local time
Tomorrow, 07:04
Joined
Nov 1, 2008
Messages
28
not sure why you use this to write to the registery.
use the Access built in SaveSetting/GetSetting functions
I never tried it under Win7 but I guess it will work.

I use this code and more like it to link to VB applications that I have made, Didn't want to use the inbuilt access one (probably cause i didn't know it existed)

I had a look at my UAC settings, they are set to minimal (lowest) and
EnableLUA in regedit is already 0
http://www.howtogeek.com/howto/wind...nt-control-uac-the-easy-way-on-windows-vista/

something is wierd though, It is working but putting them all into the following reg.... err place
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Niak32 Software\timer
instead of
HKEY_LOCAL_MACHINE\SOFTWARE\Niak32 Software\timer

I am using a 64 bit version of windows, so mabey thats it?
 

smig

Registered User.
Local time
Tomorrow, 00:04
Joined
Nov 25, 2009
Messages
2,209
why don't you try what I suggested ?

*** Edit ***
tested and work under Win7 :)
 
Last edited:

niak32

Registered User.
Local time
Tomorrow, 07:04
Joined
Nov 1, 2008
Messages
28
not sure why you use this to write to the registery.
use the Access built in SaveSetting/GetSetting functions
I never tried it under Win7 but I guess it will work.

I have additional software that use those registry keys as well.

Easiest way for me is to change the VB apps to include the new registry location. Problem solved.

Access always wrote to the registry, so that wasn't actually broken, had i searched the registry for the keys it put in, I would have found this problem a while ago.

I would like to explore access's savesettings\getsettings function as well.
Not for this project as I have found the solution.

Thanks !!
 

Users who are viewing this thread

Top Bottom