Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DOS HELP with VFP
Message
 
À
24/04/2001 15:34:52
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00499218
Message ID:
00499319
Vues:
16
>I am writing a VFP application that will connect a user and map the user to a drive using the RUN NET USE command in a VFP form. I need to be able to obtain an error number or have the screen not release after posting a successful logon or unsuccessful login attempt. I have tried using the ">" to redirect the screen message to a file with no luck. I am not able run a batch file because the username and password values are obtain from form controls. Does anyone have any suggestions has to how to obtain messages from the "net use" command???


If the machines will have Win2k or IE 5.0 or higher you could use the scripting object (you can also DL the scripting object from MS).

oNet = createobject("wscript.network")
oNet.MapNetworkDrive("drive_letter", "\\server\share_name")

If the \\server\share_name doesn't exist it throws an error. For example, on my network this:

oNet.MapNetworkDrive("K:", "\\benny\notthere")

causes a COM error that I could trap. You could wrap this in a class and have a prop or meth for the class that returns True if the mapping was done and False if it wasn't. Also
oNet.RemoveNetworkDrive("drive_letter_to_remove")
will tear it down.

HTH,
Roger
CATS Software
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform