473,378 Members | 1,469 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Checking for a registry value...

How can I lookup registry values?

I'd like to check for the existence of this folder in the registry:
HKLM\Software\AcmeCompany\MWIApplications\AutoLogo nForSharedWorkstations

so that I can use a login prompt for only these machines.

Has anyone ever done this?

Sep 29 '06 #1
3 1486

It's possible to work with the Windows registry using the
Microsoft.Win32.Registry class, and other related classes from the same
namespace.

http://msdn2.microsoft.com/en-us/lib....registry.aspx
jonefer wrote:
How can I lookup registry values?

I'd like to check for the existence of this folder in the registry:
HKLM\Software\AcmeCompany\MWIApplications\AutoLogo nForSharedWorkstations

so that I can use a login prompt for only these machines.

Has anyone ever done this?
Sep 29 '06 #2

Here is some old old vb.net code I dug up.
Notice the imports and the bad hungarian notation.


Imports Microsoft.Win32

Public Class RegReader
Public Shared Function ReadRegValue(ByVal strKeyName As String) As
String

Dim regVersion As RegistryKey
Dim keyValue As String

keyValue = "SOFTWARE\\MySubThingLikeMicrosoft"
regVersion = Registry.LocalMachine.OpenSubKey(keyValue, False)
Dim strRegistryValue As String
strRegistryValue = string.Empty
If (Not regVersion Is Nothing) Then
strRegistryValue = regVersion.GetValue(strKeyName, "")
regVersion.Close()
End If

return strRegistryValue

End Function

End Class


"jonefer" <jo*****@discussions.microsoft.comwrote in message
news:7B**********************************@microsof t.com...
How can I lookup registry values?

I'd like to check for the existence of this folder in the registry:
HKLM\Software\AcmeCompany\MWIApplications\AutoLogo nForSharedWorkstations

so that I can use a login prompt for only these machines.

Has anyone ever done this?

Sep 29 '06 #3
This is very helpful - will this bring up any 'Security' errors if the
machine that my application runs this code on doesn't have admin rights?

"sloan" wrote:
>
Here is some old old vb.net code I dug up.
Notice the imports and the bad hungarian notation.


Imports Microsoft.Win32

Public Class RegReader
Public Shared Function ReadRegValue(ByVal strKeyName As String) As
String

Dim regVersion As RegistryKey
Dim keyValue As String

keyValue = "SOFTWARE\\MySubThingLikeMicrosoft"
regVersion = Registry.LocalMachine.OpenSubKey(keyValue, False)
Dim strRegistryValue As String
strRegistryValue = string.Empty
If (Not regVersion Is Nothing) Then
strRegistryValue = regVersion.GetValue(strKeyName, "")
regVersion.Close()
End If

return strRegistryValue

End Function

End Class


"jonefer" <jo*****@discussions.microsoft.comwrote in message
news:7B**********************************@microsof t.com...
How can I lookup registry values?

I'd like to check for the existence of this folder in the registry:
HKLM\Software\AcmeCompany\MWIApplications\AutoLogo nForSharedWorkstations

so that I can use a login prompt for only these machines.

Has anyone ever done this?


Sep 30 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: GujuBoy | last post by:
i want to check to see if a certain program is installed on my windows box using python. how can i do that...(ie, i want to see if "word" is installed) please help
1
by: rdavis7408 | last post by:
I have a database that has a form that opens a report using date parameters. I have been using it for six months and last week I began to get the following Error Message: "File sharing lock...
1
by: Adnan Selimovic | last post by:
Hi folks! I have Framework 1.0 installed and I would like to point to registry from my Web.config file: <connectionString> <add key="password" value="registry:HKLM\Software\Foo,password" />...
5
by: Jeff | last post by:
Hi - I'm creating an installation program that will install a VB.NET program and an instance of MSDE on an unknown desktop (commercial application). The install will include the MSDE...
4
by: Kevin L | last post by:
I store some application settings in the registry under HKEY_LOCAL_MACHINE\Software\MyApplication I want to allow full access to this key and subkeys. Currently, I manually change the...
0
by: gsb58 | last post by:
Hi! I have a little problem with the registry function. The function is supposed to check the registry as the main form is activated. If there is a key it should not write to the registry, as it...
2
by: Ben | last post by:
I think I might have found a bug in Visual Studio. The following code should work and doesn't: My.Computer.Registry.LocalMachine.CreateSubKey("Software\Dravet")...
2
by: Nick 'The Database Guy' | last post by:
Hi All, I have writen a value to the registry. What I want to know is, is there a way that I can check that value? Thanks in advance. Nick
2
by: causesdrowsiness | last post by:
Hi everyone. Sorry if this is the wrong group for this question, but since it is .NET and VB, I thought someone may be able to help me here or point me to the right group for this. I am...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.