Hi everyone,

I am trying to add a share in my system automatically, does anyone have
a sample of the structure or an example of NetShareAdd

Thanks in advance
Tanya

Re: SHARE_INFO_2 by Rick

Rick
Fri Feb 03 12:39:56 CST 2006

Tanya,
Check out http://www.news2news.com/vfp/?group=-1&function=973, if you want the
sample code, you'll have to subscribe or purchase it individually. (I believe
both are a deal after trying to figure out some API calls on my own.)

Rick

"Tanya Legault" <tlegault@chezcora.com> wrote in message
news:O64tX2OKGHA.3200@tk2msftngp13.phx.gbl...
> Hi everyone,
>
> I am trying to add a share in my system automatically, does anyone have a
> sample of the structure or an example of NetShareAdd
>
> Thanks in advance
> Tanya
>


Re: SHARE_INFO_2 by stuartd

stuartd
Sat Feb 04 09:01:46 CST 2006

Tanya Legault wrote:
> I am trying to add a share in my system automatically,
>

Hi Tanya

You can do this quite easily with WMI:

* VFP6 and earlier need to use CreateObject syntax
oWMI = getobject("winmgmts:")
oShare = oWMI.Get("Win32_Share")
nResult = oShare.Create("c:\temp", "share_name", 0)

if nresult = 0
? "Success"
endif

There are more parameters for maximum connections and security, see
http://msdn.microsoft.com/library/en-us/wmisdk/wmi/create_method_in_class_win32_share.asp

regards

stuartd
http://weblogs.foxite.com/stuartdunkeld

Re: SHARE_INFO_2 by Tanya

Tanya
Wed Feb 08 15:01:55 CST 2006

Thank you Stuartd

I have been figting with the netshare for the last couple of hours, this
works perfectly.

Tanya
"stuartd" <user@example.net> wrote in message
news:ul3Ff.7728$Fy4.1162@newsfe4-win.ntli.net...
> Tanya Legault wrote:
>> I am trying to add a share in my system automatically,
>>
>
> Hi Tanya
>
> You can do this quite easily with WMI:
>
> * VFP6 and earlier need to use CreateObject syntax
> oWMI = getobject("winmgmts:")
> oShare = oWMI.Get("Win32_Share")
> nResult = oShare.Create("c:\temp", "share_name", 0)
>
> if nresult = 0
> ? "Success"
> endif
>
> There are more parameters for maximum connections and security, see
> http://msdn.microsoft.com/library/en-us/wmisdk/wmi/create_method_in_class_win32_share.asp
>
> regards
>
> stuartd
> http://weblogs.foxite.com/stuartdunkeld