|
-
Aug 4th, 2007, 04:23 PM
#1
Thread Starter
Frenzied Member
Unable to write to registery with Vista even as admin
My program that works fine in XP now does not write anything to the registry in Vista. I created an admin user on vista and even with that user, it still will not do this.
For example, my program lets you add or remove it from windows startup at
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
My install program that can run as administrator puts it there but my own VB app will not put it there again if I delete it manually. And I am loggin in as an admin user. Why would this be happenning?
Thanks
Warren
-
Aug 4th, 2007, 08:13 PM
#2
Re: Unable to write to registery with Vista even as admin
Vista has a lot of security advantages, i guess we can call them that. If your not a administrator account it could be it is writing to a different key. I believe it writes to a different key silently. Check if there are any new keys HKEY_####, have a read of the below link to:
Modifications Required for VB6 Applications to work on VB6
Last edited by Paul M; Aug 4th, 2007 at 08:19 PM.
-
Aug 4th, 2007, 08:39 PM
#3
Re: Unable to write to registery with Vista even as admin
No, you shouldnt be writting to the registry anymore. Vista uses a process called Registry Virtualization which is why you are not finding your writes.
You can not write to HKLM anymore. Also, Microsoft is only providing the virtualization workaround on a temporary basic. It will be discontinued so you shouldnt use the workaround or rely upon it.
Last edited by RobDog888; Aug 4th, 2007 at 10:03 PM.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Aug 5th, 2007, 08:42 AM
#4
Thread Starter
Frenzied Member
Re: Unable to write to registery with Vista even as admin
How owuld you add your program to startup if you cannot write to the registry anymore?
And if I should not be using the registry anymore, do we have to go back to ini files then?
Thanks
-
Aug 5th, 2007, 09:13 AM
#5
Thread Starter
Frenzied Member
Re: Unable to write to registery with Vista even as admin
Also, other software can still write to the registry such as my installer I use. It can write anywhere in the registry including in the Run area. So why would another program be able to write to the registry but VB6 apps cannot?
Warren
-
Aug 5th, 2007, 09:31 AM
#6
Re: Unable to write to registery with Vista even as admin
Use the CurrentUser hive:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
-
Aug 5th, 2007, 10:00 AM
#7
Thread Starter
Frenzied Member
Re: Unable to write to registery with Vista even as admin
I want it to run for all users that login though.
-
Aug 5th, 2007, 10:23 AM
#8
Re: Unable to write to registery with Vista even as admin
 Originally Posted by WarrenW
I want it to run for all users that login though.
Unless one of them disables it, at which point it no longer runs at startup for anybody? Is that really the functionality you want?
-
Aug 5th, 2007, 10:28 AM
#9
Re: Unable to write to registery with Vista even as admin
You could handle it this way:
Installer adds key to LocalMachine\Run, but includes a command line parameter to indicate it's an autorun on startup. When program launches, before doing or displaying anything, it first checks the command line parameter to see if it's been autorun. If so, it checks a registry key under CurrentUser\Software\Company\App to see if this user wants to run on startup. If the key isn't there, create the key defaulting to yes and load normally. If the key is there and says no, exit gracefully without showing the user anything.
That way it will run on startup for everyone after install until they disable it, at which point it is only disabled for that user.
I'm not saying this is a particularly good way to go, but it would work.
-
Aug 5th, 2007, 10:41 AM
#10
Thread Starter
Frenzied Member
Re: Unable to write to registery with Vista even as admin
I'm just puzzled why I cannot write to the registry when other software can. I use the Install Creator Pro by clickteam.com and they have a checkbox to make it run as an administrator so it can do this stuff. Why can't we do this in VB6? Is there something special they can do in C++ or other language that is not supported in VB6?
Thanks
-
Aug 5th, 2007, 01:17 PM
#11
Re: Unable to write to registery with Vista even as admin
How are you writting to the registry? Using the APIs?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Aug 5th, 2007, 02:58 PM
#12
Thread Starter
Frenzied Member
Re: Unable to write to registery with Vista even as admin
Yes, I use APIs for read and write on the registry. I tested out writing to the HKCU and I can do that as you said. I was wanting to use HKLM so all users will have the same settings which I need.
I'll keep tinkering with it all!
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|