Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Win2000 and mapping a drive problem
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00613353
Message ID:
00613429
Vues:
11
>>When the following code gets run on Win2000 a new window pops up showing the newly mapped drive. How can we supress this window? We don't have this problem on NT or Win9X OSs. We would rather the users not be confused with this new window.
>>

You can use the Win api to connect without this annoying window...
*FUNCTION ConnectDrive
LPARAMETERS LocalDriveLetter, RemoteName, CurrentUserPassword
***************
*	Param:
*		LocalDriveLetter = letter to assing to the connection
*		RemoteName = sharename of the directory to be mapped (\\server\drive)
*		CurrentUserPassword = optionnal,if differ from the local password
*
***************
*!*	DWORD WNetAddConnection(
*!*	    LPTSTR  lpszRemoteName,	// address of network device name  
*!*	    LPTSTR  lpszPassword,	// address of password 
*!*	    LPTSTR  lpszLocalName 	// address of local device name 
*!*	   )

DECLARE DOUBLE WNetAddConnection IN MPR.DLL ;
    STRING @ lpszRemoteName,;
    STRING @ lpszPassword,;
    STRING @ lpszLocalName

IF LEN(LocalDriveLetter) = 1
	LocalDriveLetter=LocalDriveLetter+':'
ELSE
	LocalDriveLetter=SUBSTR(LocalDriveLetter,1,1)+':'
ENDIF
IF TYPE('CurrentUserPassword') = 'L'
	CurrentUserPassword=.NULL.
ENDIF	
IF !DIRECTORY(LocalDriveLetter+'\')
	? WNetAddConnection(@RemoteName,@CurrentUserPassword,@LocalDriveLetter)
ENDIF
	
HTH :-)
If we exchange an apple, we both get an apple.
But if we exchange an idea, we both get 2 ideas, cool...


Gérald Santerre
Independant programmer - internet or intranet stuff - always looking for contracts big or small :)
http://www.siteintranet.qc.ca
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform