NetRedir( <cLocal> , ;
<cServer> , ;
[<cPassword>], ;
[<lShowError>] ) --> lSuccess
NetRedir( "Z:", "\\SERVER\CARPETA", "Password" , .T. )
WaitRun("Net use \\168.1.1.3\D$ clave /user:usuario",0) //El usuario tiene que tener permiso de administrador
SET DEFAULT TO \\168.1.1.3\D$\SISTEMAS
*ES RECOMENDABLE NO COLOCAR LAS APLICACIONES EN UNIDAD C:
*AL SALIR
WinRun("Net use \\168.1.1.3\D$ /delete",0)
HB_FUNC( NETREDIR )
{
DWORD dwResult;
LPTSTR lpLocalDev = HB_TCHAR_CONVTO( hb_parcx( 1 ) );
LPTSTR lpSharedRes = HB_TCHAR_CONVTO( hb_parcx( 2 ) );
LPTSTR lpPassword = HB_TCHAR_CONVTO( hb_parcx( 3 ) );
BOOL bShowError = ( ISLOG( 4 ) ? hb_parl( 4 ) : FALSE );
if( hb_pcount() >= 3 && ISCHAR( 3 ) )
{
dwResult = WNetAddConnection( lpSharedRes, lpPassword, lpLocalDev );
}
else
{
dwResult = WNetAddConnection( lpSharedRes, NULL, lpLocalDev );
}
if( dwResult == NO_ERROR )
{
hb_retl( TRUE );
}
else
{
if( bShowError )
{
char szCommand[80];
hb_snprintf( szCommand, 80, "NETREDIR( \"%s\", \"%s\", \"%s\" )",
hb_parcx( 1 ), hb_parcx( 2 ), hb_parcx( 3 ) );
WNetErrorHandler( dwResult, szCommand );
}
hb_retl( FALSE );
}
}
source\ct\ctnet.C
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: No registered users and 25 guests