|
-
Mar 26th, 2002, 02:36 PM
#1
Thread Starter
Hyperactive Member
FYI: using the registry class
This is partially FYI and partially in response to Phil's question in the VB forum...
Using the registry, if you've looked into it, is largely undocumented. Hopefully the following code will save you some time:
PHP Code:
// The instance of the Registry key class is created by the
// static method OpenSubKey in the Registry class
// The second boolean parameter opens the key for editing if true
RegistryKey RegTest = Registry.LocalMachine.OpenSubKey("SOFTWARE\\TESTKEY",true);
// This results in a DWORD key
int testValue1 = 50 ;
// This results in a multi line string entry
string[] testValue2 = new String[3] {"Eat","my","shorts"};
// This results in a byte field (a non-array will be a simple byte key)
byte[] testValue3 = new byte[3] {1,2,3};
// Almost any other type results in a string, REG_SZ
// Creates a new key and value under the current subkey
RegTest.SetValue("TestValue1",testValue1) ;
RegTest.SetValue("TestValue2",testValue2) ;
RegTest.SetValue("TestValue3",testValue3) ;
-scott
he he he
-
Oct 2nd, 2002, 05:57 PM
#2
Member
I have worked out the REG_SZ and REG_DWORD but I cannot workout how to get REG_BINARY and REG_MULTI_SZ to work. Do you have any code to get this to work for VB.NET?
-
Oct 4th, 2002, 11:55 AM
#3
Thread Starter
Hyperactive Member
The sample code I wrote originally works and demonstrates all the major reg types.
For binary, you are passing a byte array. For reg_multi_sz you just pass in an array of strings.
-hope that helps
-scott
he he he
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
|