Try this. I don't have network shares, so I can't test. Tell me if it works.
err = registerfuncs()
IF err \== "" THEN DO
SAY err
RETURN
END
netr.1 = 2
netr.2 = 1
netr.3 = 3
netr.4 = 1
netr.5 = "X:"
netr.6 = "\\ServerName\ShareName"
err = addnetdrive("NetR", "MyPassword", "MyUserName", 1)
IF err \= 0 THEN DO
SAY "AddNetDrive failed:" err
RETURN
END
err = removenetdrive("X:", 1 , 0)
IF err \= 0 THEN SAY "RemoveNetDrive failed:" err
RETURN
registerfuncs: PROCEDURE
netresource = "32u,32u,32u,32u,str *,str *,str *,str *"
err = FUNCDEF("AddNetDrive", "32u,struct NETRESOURCE,str,str,32u", "mpr.dll", "WNetAddConnection2A")
IF err = 0 THEN DO
err = FUNCDEF("RemoveNetDrive", "32u,str,32u,32u", "mpr.dll", "WNetCancelConnection2A")
IF err \= 0 THEN RETURN "Registering RemoveNetDrive failed:" err
RETURN ""
END
RETURN "Registering AddNetDrive failed:" err |