Thanx guys for the reply.
Thanx alex_read i got the sample code from allapi. That really helped me out!!!