You need to use a couple of API calls - there's a great tutorial here that won't take you long to go through :

http://www.vb-world.net/registry/