|
-
Aug 28th, 2000, 01:32 PM
#1
Thread Starter
Hyperactive Member
I've never played in the Registry via code, so I need some help...
I want to take entries from the registry and place them in a text box, but don't know how to begin.
The registry path is as follows:
HKEY_LOCAL_MACHINE\SOFTWARE\Vendor Name\Program Name\Domains\Banned
and the entries will have sequential names, starting at 0 and increasing by 1. The values are IP addresses using from 1 to 4 nodes.
Examples include:
123.123.*.*
123.255.255.123
and so on...
How can I load these IP's to a list box in my VB6 program?
Thanks!
-
Aug 28th, 2000, 01:41 PM
#2
Monday Morning Lunatic
There's a sample project with full registry code here: http://www.parksie.uklinux.net/registry.zip
Then, just loop through the items, and collect the addresses:
Code:
For i = 1 to 5
List1.AddItem GetString(HKEY_CURRENT_USER, "Software\My Company\IPs", "IP" & i)
Next i
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Aug 28th, 2000, 02:03 PM
#3
Thread Starter
Hyperactive Member
Ok, that works good, but how can I know how many itmes are in the registry? It could be zero, could be 100...
Thanks!!
-
Aug 28th, 2000, 02:13 PM
#4
Monday Morning Lunatic
Quick hack version: check the response. If it's a null string, then it doesn't exist so break out of the loop. My code doesn't have anything in for counting the number of values. The registry API is no help because it only tells you the total number of values, not the number you want. The simplest way is probably to have a DWORD value, with the number of IP addresses present.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Aug 28th, 2000, 02:21 PM
#5
Thread Starter
Hyperactive Member
OUTSTANDING!!
Thank you SO much for your help!
I REALLY appreciate it.
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
|