Ver Mensaje Individual
  #3 (permalink)  
Antiguo 17/07/2009, 13:14
Rolonauta
 
Fecha de Ingreso: julio-2009
Mensajes: 4
Antigüedad: 14 años, 10 meses
Puntos: 0
De acuerdo Respuesta: Copiar desde servidor a Pc

'''''''''''''''''''''''''''''''''''''''''''''''''' '''
' Apis para buscar ficheros
Private Declare Function FindClose Lib "kernel32" (ByVal hFindFile As Long) As Long
Private Declare Function FindFirstFile Lib "kernel32" Alias "FindFirstFileA" (ByVal lpFilename As String, lpFindFileData As WIN32_FIND_DATA) As Long
Private Declare Function ShellAbout Lib "shell32.dll" Alias "ShellAboutA" (ByVal hwnd As Long, ByVal szApp As String, ByVal szOtherStuff As String, ByVal hIcon As Long) As Long

Private Const INVALID_HANDLE_VALUE = -1
Private Const MAX_PATH = 260

' UDT para FindFirstFile
Private Type FILETIME
dwLowDateTime As Long
dwHighDateTime As Long
End Type

Private Type WIN32_FIND_DATA
dwFileAttributes As Long
ftCreationTime As FILETIME
ftLastAccessTime As FILETIME
ftLastWriteTime As FILETIME
nFileSizeHigh As Long
nFileSizeLow As Long
dwReserved0 As Long
dwReserved1 As Long
cFileName As String * MAX_PATH
cAlternate As String * 14
End Type
'''''''''''''''''''''''''''''''''''''''''''''''''' '''''
Private Const REG_SZ = 1 'Constant for a string variable type.
Private Const HKEY_LOCAL_MACHINE = &H80000002

Private Declare Function RegCreateKey Lib "advapi32.dll" Alias _
"RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, _
phkResult As Long) As Long

Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias _
"RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, _
ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal _
cbData As Long) As Long

Private Declare Function RegCloseKey Lib "advapi32.dll" _
(ByVal hKey As Long) As Long


Option Explicit


Private Sub CmdCopiar_Click()
Set pOperArchivo = CreateObject("Scripting.FileSystemObject")
RUTAOrigen= "\1952.168.1.85\" & archivo.txt
pOperArchivo.copyfile RUTAOrigen, "C:\"
End Sub

Espero te sirva este ejemplo muestra como el codigo de copiado en visual basic , tendrias que remplazar el IP por tu ip del servidor o por el nombre del servidor.

saludos

Rolando Lau