|
-
Feb 18th, 2010, 04:27 AM
#1
Thread Starter
Lively Member
Check Byte data of a registry value
How to check the data inside this value anyone ?
-
Feb 18th, 2010, 04:44 AM
#2
Re: Check Byte data of a registry value
You would call My.Computer.Registry.GetValue, specifying the key and value names, and assign the result to a variable whose type is Byte(), i.e. Byte array. You can then test each individual element of that Byte array.
-
Feb 19th, 2010, 08:04 AM
#3
Thread Starter
Lively Member
Re: Check Byte data of a registry value
Unfortunately, i understand your solution but i know almost nothing about VB.NET, so can you please give me a bit more details
-
Feb 19th, 2010, 09:45 PM
#4
Re: Check Byte data of a registry value
You know that you need to use My.Computer.Registry.GetValue. When you searched for that on the web and in the MSDN documentation, what examples did you find? Did any of them include use of a Byte array?
http://www.google.com.au/search?q=my...ient=firefox-a
First result:
http://www.java2s.com/Tutorial/VB/04...ryGetValue.htm
Demonstrates how to retrieve data from the Registry and how to use a Byte array so retrieved. You don't need any programming experience to search the web. If you have no idea where to start, which may have been the case when you first posted, obviously you can't search. Once someone provides you with the keywords, the first thing you should be doing is searching for those keywords. Whatever it is that you want to do, there's most likely already examples out there. If you know what to search for, e.g. type names, method names, etc, then finding those existing examples is usually fairly easy.
Last edited by jmcilhinney; Feb 19th, 2010 at 09:53 PM.
-
Feb 21st, 2010, 11:56 PM
#5
Re: Check byte data in a registry value
Please do not start a new thread when you already have a thread for this question. Not only do you already have a thread for this question, you already have an answer. You say that you don't know how yet in your other thread I provided a link that contains code that shows how to do it. Have you read that code and made an effort to write some code for yourself?
http://www.vbforums.com/showthread.php?t=603978
-
Feb 22nd, 2010, 12:04 AM
#6
Thread Starter
Lively Member
Re: Check byte data in a registry value
vb Code:
Option Strict On Public Module RegistryTest Public Sub Main() Dim data As Object data = My.Computer.Registry.GetValue("HKEY_CLASSES_ROOT\wrifile\DefaultIcon", _ String.Empty, String.Empty) If TypeOf data Is String Then Console.WriteLine("String data: " & data.ToString()) ElseIf TypeOf data Is Integer Then Console.WriteLine("Integer data: " & CInt(data)) ElseIf TypeOf data Is String() Then Console.WriteLine("String array: ") Dim dataArray() As String = DirectCast(data, String()) For ctr As Integer = LBound(dataArray, 1) To UBound(dataArray, 1) Console.WriteLine(" " & dataArray(ctr)) Next ElseIf typeOf data Is Byte() Then Console.WriteLine("Binary data: ") Dim byteArray() As Byte = DirectCast(data, Byte()) For ctr As Integer = LBound(byteArray, 1) To UBound(byteArray, 1) Console.Write(" " & Hex(byteArray(ctr)) & " ") Next Else Console.WriteLine("Unknown data type...") End If End Sub End Module
Sorry for the inconvenience , but can you please give me an detail example
-
Feb 22nd, 2010, 12:13 AM
#7
Re: Check byte data in a registry value
What is that code if not a detailed example? Exactly what is it about the information you already have that you don't understand? I said that you should use My.Computer.Registry.GetValue to get the data from the Registry as a Byte array, then you can examine the contents of that Byte array. That code does exactly that. It handles other data types too but you can simply ignore the parts that you don't need.
-
Feb 22nd, 2010, 12:25 AM
#8
Thread Starter
Lively Member
Re: Check byte data in a registry value
i created a windows form with a checkbox to check data of a value inside registry key.I had code to check string,dword data however i had no idea how to check byte data. You told me to use My.computer.Registry.Getvalue but to tell the truth i don't know anything, just someone give me the code my job is to copy and edit the name,key, value etc...
So can you show me the code to check if a value contains exact byte data as i expect the checkbox will show a check, if not nothing is showed
-
Feb 22nd, 2010, 12:47 AM
#9
Re: VS 2008 Check byte data in a registry value
So basically you already know how to get data from the Registry because you're already doing it. If that's the case, why did you not say so? You're asking us to show you something that you already know how to do. Your only problem is checking the values of the elements in a Byte array, which has nothing to do with the Registry. A Byte array is a Byte array. Where it came from is irrelevant.
So, do you know how to get an element from an array? If not, look at the code you just posted. It does it twice, in the string array and byte array sections. What are the elements of a Byte array? By definition, they are Bytes. So, what do you have to do to test the contents of a Byte array? You would probably first test its Length. If the number of Bytes in the array is not correct then the whole thing can't possibly be correct. Assuming the Length is correct, you then simply test each element. You know how to get an element from an array because its in the code you yourself posted. Just get each element and test it against the expected value. If one doesn't match then the whole lot doesn't match.
-
Feb 22nd, 2010, 12:56 AM
#10
Thread Starter
Lively Member
Re: VS 2008 Check byte data in a registry value
-
Feb 22nd, 2010, 01:13 AM
#11
Re: Check Byte data of a registry value
Please do not create duplicate threads. It is not an accepted practice on our Forums.
Duplicate Thread Merged
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 
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
|