First, if your post really is just saying "I know how to do it but I'm
not sharing", which is how I'm reading it, then what are you doing
here? If that's your attitude about learing to write software and
helping others then you don't belong here.
Second, you can't really sell code that is so generic and easily
reproducible that it's a basic concept anyone working with the
registry in .net can do (see below).
Good bye,
Sam
Imports Microsoft.Win32
Public Class RegSearch
Public Shared Sub Search(ByVal text As String)
For Each key As RegistryKey In New RegistryKey() { _
Registry.ClassesRoot, _
Registry.CurrentConfig, _
Registry.CurrentUser, _
Registry.LocalMachine, _
Registry.Users _
}
SearchKey(text, key)
Next
Console.WriteLine("Done")
End Sub
Private Shared Sub SearchKey(ByVal text As String, ByVal key As
RegistryKey)
If key Is Nothing Then
Return
End If
If key.Name.IndexOf(text) > -1 Then
Console.WriteLine("Found in " + key.ToString())
End If
For Each valueName As String In key.GetValueNames()
If valueName.IndexOf(text) > -1 Then
Console.WriteLine("Found in " + key.ToString() + ", " +
valueName)
End If
Dim value As Object = key.GetValue(valueName)
If Not value Is Nothing AndAlso _
value.ToString().IndexOf(text) > -1 Then
Console.WriteLine("Found in " + key.ToString() + ", " +
valueName + ": " + value.ToString())
End If
Next
For Each subKeyName As String In key.GetSubKeyNames()
Try
SearchKey(text, key.OpenSubKey(subKeyName))
Catch ex As Security.SecurityException
' can't search this one, just skip it
End Try
Next
End Sub
End Class
On Wed, 2 Feb 2005 10:21:06 -0800, Crouchie1998
<Cr**********@discussions.microsoft.com> wrote:
I wrote a recursive registry search function around 4 months ago, but that
only lists the results in a listview. However, its on a CD I have created for
sale & don't want the code to be posted here because it seems that I am the
first person to do this in VB.NET, as there isn't anything on the Internet
about it. Its not complicated code though, but that's my opinion.
Sorry, but I am not prepared to compromise future sales of my CD to answer
this question. I made the mistake of uploading a shutdown/restart/logoff/lock
solution in VB.NET & now everyone has copied my code.