>Is there any way by which I can remove the sharing and again set it back of a particular drive through a VFP program using API calls.
>
The Win32API call WNetCancelConnection2() will delete a drive mapping, and WNetAddConnection() or WNetAddConnection2() or WNetAddConnection3() will create a new drive mapping. It'd be your responsibility to track any drive mappings in effect before your application started.
A better (or at least easier approach) if you're willing to assure that the Windows Script Host is installed on all target systems is to use the automation object Wscript.Network to do this work. The Wscript.Network object has the methods MapNetworkDrive and RemoveNetworkDrive, and a method EnumNetworkDrives that will return an array of current drive mappings, which makes it relatively easy to restore the state before your app started running (on entry, grab the list of drive mapings using EnumNetworkDrives, save the array somewhere, and if you have to restore the state later, issue another EnumNetworkDrives and compare the current reality with the way the world worked before you started.)
You can get more information on the WSH at msdn.microsoft.com/scripting and I'd recommend picking up the book
Windows Script Host Programmer's Reference or
VBSCRIPT Programmer's Reference (both published by WROX Press,
www.wrox.com or through Amazon or B&N) if you aren't familiar the WSH and scripting.