Hi all, I´m not speak english so well, but i'll try to do it better. I have a problem with the filecopy function when i use the IP instead of a computer name. For example
This sentence works ok
FileCopy "\\gdl1mfg994\q ualcomm\k2.pdf" , "\\gdl1me090\di bujos\bety.pdf"
But this doesn't work
FileCopy "\\168.192.1.16 \qualcomm\k2.pd f", "\\168.190.4.14 \dibujos\bety.p df"
It display this error: "path not found"
Can anybody help me???
3 2445
Hi all, I´m not speak english so well, but i'll try to do it better. I have a problem with the filecopy function when i use the IP instead of a computer name. For example
This sentence works ok
FileCopy "\\gdl1mfg994\q ualcomm\k2.pdf" , "\\gdl1me090\di bujos\bety.pdf"
But this doesn't work
FileCopy "\\168.192.1.16 \qualcomm\k2.pd f", "\\168.190.4.14 \dibujos\bety.p df"
It display this error: "path not found"
Can anybody help me???
Hi,
Do u try by the Internet Transfer Control?
Hello,
you have first to convert the ip to hostname to copy
you can use this code - '**************************************
-
'Windows API/Global Declarations for :IP
-
' Resolver - IP Address Convert to Hostnam
-
' e
-
'**************************************
-
'PUT THIS IS A MODULE
-
Option Explicit
-
'||================================||
-
'|| Remember to use:||
-
'|| WSACleanup in Form_Unload()||
-
'|| IP_Initialize in Form_Load() ||
-
'||================================||
-
Const WSADescription_Len = 256
-
Const WSASYS_Status_Len = 128
-
-
-
Private Type HOSTENT
-
hName As Long
-
hAliases As Long
-
hAddrType As Integer
-
hLength As Integer
-
hAddrList As Long
-
End Type
-
-
-
Private Type WSADATA
-
wversion As Integer
-
wHighVersion As Integer
-
szDescription(0 To WSADescription_Len) As Byte
-
szSystemStatus(0 To WSASYS_Status_Len) As Byte
-
iMaxSockets As Integer
-
iMaxUdpDg As Integer
-
lpszVendorInfo As Long
-
End Type
-
-
-
Declare Function WSACleanup Lib "wsock32" () As Long
-
-
-
Private Declare Function WSAStartup Lib "wsock32" _
-
(ByVal VersionReq As Long, WSADataReturn As WSADATA) As Long
-
-
-
Private Declare Function WSAGetLastError Lib "wsock32" () As Long
-
-
-
Private Declare Function gethostbyaddr Lib "wsock32" (addr As Long, addrLen As Long, _
-
addrType As Long) As Long
-
-
-
Private Declare Function gethostbyname Lib "wsock32" (ByVal hostname As String) As Long
-
-
-
Private Declare Sub RtlMoveMemory Lib "kernel32" (hpvDest As Any, ByVal hpvSource As Long, _
-
ByVal cbCopy As Long)
-
'checks if string is valid IP address
-
-
-
Private Function IsIP(ByVal strIP As String) As Boolean
-
On Error Resume Next
-
Dim t As String: Dim s As String: Dim i As Integer
-
s = strIP
-
-
-
While InStr(s, ".") <> 0
-
t = Left(s, InStr(s, ".") - 1)
-
If IsNumeric(t) And Val(t) >= 0 And Val(t) <= 255 Then s = Mid(s, InStr(s, ".") + 1) _
-
Else Exit Function
-
i = i + 1
-
Wend
-
t = s
-
If IsNumeric(t) And InStr(t, ".") = 0 And Len(t) = Len(Trim(Str(Val(t)))) And _
-
Val(t) >= 0 And Val(t) <= 255 And strIP <> "255.255.255.255" And i = 3 Then IsIP = True
-
-
-
If Err.Number > 0 Then
-
MsgBox Err.Description, , Err.Number
-
Err.Clear
-
End If
-
End Function
-
'converts IP address from string to sin_
-
' addr
-
-
-
Private Function MakeIP(strIP As String) As Long
-
On Error Resume Next
-
Dim lIP As Long
-
lIP = Left(strIP, InStr(strIP, ".") - 1)
-
strIP = Mid(strIP, InStr(strIP, ".") + 1)
-
lIP = lIP + Left(strIP, InStr(strIP, ".") - 1) * 256
-
strIP = Mid(strIP, InStr(strIP, ".") + 1)
-
lIP = lIP + Left(strIP, InStr(strIP, ".") - 1) * 256 * 256
-
strIP = Mid(strIP, InStr(strIP, ".") + 1)
-
-
-
If strIP < 128 Then
-
lIP = lIP + strIP * 256 * 256 * 256
-
Else
-
lIP = lIP + (strIP - 256) * 256 * 256 * 256
-
End If
-
MakeIP = lIP
-
-
-
If Err.Number > 0 Then
-
MsgBox Err.Description, , Err.Number
-
Err.Clear
-
End If
-
End Function
-
'resolves IP address to host name
-
-
-
Function NameByAddr(strAddr As String) As String
-
On Error Resume Next
-
Dim nRet As Long
-
Dim lIP As Long
-
Dim strHost As String * 255: Dim strTemp As String
-
Dim hst As HOSTENT
-
-
-
-
If IsIP(strAddr) Then
-
lIP = MakeIP(strAddr)
-
nRet = gethostbyaddr(lIP, 4, 2)
-
-
-
If nRet <> 0 Then
-
RtlMoveMemory hst, nRet, Len(hst)
-
RtlMoveMemory ByVal strHost, hst.hName, 255
-
strTemp = strHost
-
If InStr(strTemp, Chr(10)) <> 0 Then strTemp = Left(strTemp, InStr(strTemp, Chr(0)) - 1)
-
strTemp = Trim(strTemp)
-
NameByAddr = strTemp
-
Else
-
MsgBox "Host name Not found", , "9003"
-
Exit Function
-
End If
-
Else
-
MsgBox "Invalid IP address", , "9002"
-
Exit Function
-
End If
-
-
-
If Err.Number > 0 Then
-
MsgBox Err.Description, , Err.Number
-
Err.Clear
-
End If
-
End Function
-
'resolves host name to IP address
-
-
-
Function AddrByName(ByVal strHost As String)
-
On Error Resume Next
-
Dim hostent_addr As Long
-
Dim hst As HOSTENT
-
Dim hostip_addr As Long
-
Dim temp_ip_address() As Byte
-
Dim i As Integer
-
Dim ip_address As String
-
-
-
If IsIP(strHost) Then
-
AddrByName = strHost
-
Exit Function
-
End If
-
hostent_addr = gethostbyname(strHost)
-
-
-
If hostent_addr = 0 Then
-
MsgBox "Can't resolve hst", , "9001"
-
Exit Function
-
End If
-
RtlMoveMemory hst, hostent_addr, LenB(hst)
-
RtlMoveMemory hostip_addr, hst.hAddrList, 4
-
ReDim temp_ip_address(1 To hst.hLength)
-
RtlMoveMemory temp_ip_address(1), hostip_addr, hst.hLength
-
-
-
For i = 1 To hst.hLength
-
ip_address = ip_address & temp_ip_address(i) & "."
-
Next
-
ip_address = Mid(ip_address, 1, Len(ip_address) - 1)
-
AddrByName = ip_address
-
-
-
If Err.Number > 0 Then
-
MsgBox Err.Description, , Err.Number
-
Err.Clear
-
End If
-
End Function
-
-
-
Sub IP_Initialize()
-
Dim udtWSAData As WSADATA
-
-
-
If WSAStartup(257, udtWSAData) Then
-
MsgBox Err.Description, , Err.LastDllError
-
End If
-
End Sub
-
'||================================||
-
'|| Remember to use:||
-
'|| WSACleanup in Form_Unload()||
-
'|| IP_Initialize in Form_Load() ||
-
'||================================||
-
-
- 'How do you call these Functions?
-
Option Explicit
-
-
-
Private Sub Command1_Click()
-
Text1.Text = NameByAddr(Text2)
-
End Sub
-
-
-
Private Sub Command2_Click()
-
Text2.Text = AddrByName("www.yahoo.com")
-
End Sub
-
-
-
Private Sub Form_Load()
-
IP_Initialize
-
End Sub
-
-
-
Private Sub Form_Unload(Cancel As Integer)
-
WSACleanup
-
End Sub
-
Hello,
you have first to convert the ip to hostname to copy
you can use this code - '**************************************
-
'Windows API/Global Declarations for :IP
-
' Resolver - IP Address Convert to Hostnam
-
' e
-
'**************************************
-
'PUT THIS IS A MODULE
-
Option Explicit
-
'||================================||
-
'|| Remember to use:||
-
'|| WSACleanup in Form_Unload()||
-
'|| IP_Initialize in Form_Load() ||
-
'||================================||
-
Const WSADescription_Len = 256
-
Const WSASYS_Status_Len = 128
-
-
-
Private Type HOSTENT
-
hName As Long
-
hAliases As Long
-
hAddrType As Integer
-
hLength As Integer
-
hAddrList As Long
-
End Type
-
-
-
Private Type WSADATA
-
wversion As Integer
-
wHighVersion As Integer
-
szDescription(0 To WSADescription_Len) As Byte
-
szSystemStatus(0 To WSASYS_Status_Len) As Byte
-
iMaxSockets As Integer
-
iMaxUdpDg As Integer
-
lpszVendorInfo As Long
-
End Type
-
-
-
Declare Function WSACleanup Lib "wsock32" () As Long
-
-
-
Private Declare Function WSAStartup Lib "wsock32" _
-
(ByVal VersionReq As Long, WSADataReturn As WSADATA) As Long
-
-
-
Private Declare Function WSAGetLastError Lib "wsock32" () As Long
-
-
-
Private Declare Function gethostbyaddr Lib "wsock32" (addr As Long, addrLen As Long, _
-
addrType As Long) As Long
-
-
-
Private Declare Function gethostbyname Lib "wsock32" (ByVal hostname As String) As Long
-
-
-
Private Declare Sub RtlMoveMemory Lib "kernel32" (hpvDest As Any, ByVal hpvSource As Long, _
-
ByVal cbCopy As Long)
-
'checks if string is valid IP address
-
-
-
Private Function IsIP(ByVal strIP As String) As Boolean
-
On Error Resume Next
-
Dim t As String: Dim s As String: Dim i As Integer
-
s = strIP
-
-
-
While InStr(s, ".") <> 0
-
t = Left(s, InStr(s, ".") - 1)
-
If IsNumeric(t) And Val(t) >= 0 And Val(t) <= 255 Then s = Mid(s, InStr(s, ".") + 1) _
-
Else Exit Function
-
i = i + 1
-
Wend
-
t = s
-
If IsNumeric(t) And InStr(t, ".") = 0 And Len(t) = Len(Trim(Str(Val(t)))) And _
-
Val(t) >= 0 And Val(t) <= 255 And strIP <> "255.255.255.255" And i = 3 Then IsIP = True
-
-
-
If Err.Number > 0 Then
-
MsgBox Err.Description, , Err.Number
-
Err.Clear
-
End If
-
End Function
-
'converts IP address from string to sin_
-
' addr
-
-
-
Private Function MakeIP(strIP As String) As Long
-
On Error Resume Next
-
Dim lIP As Long
-
lIP = Left(strIP, InStr(strIP, ".") - 1)
-
strIP = Mid(strIP, InStr(strIP, ".") + 1)
-
lIP = lIP + Left(strIP, InStr(strIP, ".") - 1) * 256
-
strIP = Mid(strIP, InStr(strIP, ".") + 1)
-
lIP = lIP + Left(strIP, InStr(strIP, ".") - 1) * 256 * 256
-
strIP = Mid(strIP, InStr(strIP, ".") + 1)
-
-
-
If strIP < 128 Then
-
lIP = lIP + strIP * 256 * 256 * 256
-
Else
-
lIP = lIP + (strIP - 256) * 256 * 256 * 256
-
End If
-
MakeIP = lIP
-
-
-
If Err.Number > 0 Then
-
MsgBox Err.Description, , Err.Number
-
Err.Clear
-
End If
-
End Function
-
'resolves IP address to host name
-
-
-
Function NameByAddr(strAddr As String) As String
-
On Error Resume Next
-
Dim nRet As Long
-
Dim lIP As Long
-
Dim strHost As String * 255: Dim strTemp As String
-
Dim hst As HOSTENT
-
-
-
-
If IsIP(strAddr) Then
-
lIP = MakeIP(strAddr)
-
nRet = gethostbyaddr(lIP, 4, 2)
-
-
-
If nRet <> 0 Then
-
RtlMoveMemory hst, nRet, Len(hst)
-
RtlMoveMemory ByVal strHost, hst.hName, 255
-
strTemp = strHost
-
If InStr(strTemp, Chr(10)) <> 0 Then strTemp = Left(strTemp, InStr(strTemp, Chr(0)) - 1)
-
strTemp = Trim(strTemp)
-
NameByAddr = strTemp
-
Else
-
MsgBox "Host name Not found", , "9003"
-
Exit Function
-
End If
-
Else
-
MsgBox "Invalid IP address", , "9002"
-
Exit Function
-
End If
-
-
-
If Err.Number > 0 Then
-
MsgBox Err.Description, , Err.Number
-
Err.Clear
-
End If
-
End Function
-
'resolves host name to IP address
-
-
-
Function AddrByName(ByVal strHost As String)
-
On Error Resume Next
-
Dim hostent_addr As Long
-
Dim hst As HOSTENT
-
Dim hostip_addr As Long
-
Dim temp_ip_address() As Byte
-
Dim i As Integer
-
Dim ip_address As String
-
-
-
If IsIP(strHost) Then
-
AddrByName = strHost
-
Exit Function
-
End If
-
hostent_addr = gethostbyname(strHost)
-
-
-
If hostent_addr = 0 Then
-
MsgBox "Can't resolve hst", , "9001"
-
Exit Function
-
End If
-
RtlMoveMemory hst, hostent_addr, LenB(hst)
-
RtlMoveMemory hostip_addr, hst.hAddrList, 4
-
ReDim temp_ip_address(1 To hst.hLength)
-
RtlMoveMemory temp_ip_address(1), hostip_addr, hst.hLength
-
-
-
For i = 1 To hst.hLength
-
ip_address = ip_address & temp_ip_address(i) & "."
-
Next
-
ip_address = Mid(ip_address, 1, Len(ip_address) - 1)
-
AddrByName = ip_address
-
-
-
If Err.Number > 0 Then
-
MsgBox Err.Description, , Err.Number
-
Err.Clear
-
End If
-
End Function
-
-
-
Sub IP_Initialize()
-
Dim udtWSAData As WSADATA
-
-
-
If WSAStartup(257, udtWSAData) Then
-
MsgBox Err.Description, , Err.LastDllError
-
End If
-
End Sub
-
'||================================||
-
'|| Remember to use:||
-
'|| WSACleanup in Form_Unload()||
-
'|| IP_Initialize in Form_Load() ||
-
'||================================||
-
-
- 'How do you call these Functions?
-
Option Explicit
-
-
-
Private Sub Command1_Click()
-
Text1.Text = NameByAddr(Text2)
-
End Sub
-
-
-
Private Sub Command2_Click()
-
Text2.Text = AddrByName("www.yahoo.com")
-
End Sub
-
-
-
Private Sub Form_Load()
-
IP_Initialize
-
End Sub
-
-
-
Private Sub Form_Unload(Cancel As Integer)
-
WSACleanup
-
End Sub
-
If it works, its a great archive for all of us. Thanks.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Thomas J. Clancy |
last post by:
I was wondering if anyone knew of a way to use std::copy() and
istream_iterator<>/ostream_iterator<> write a file copy function that is
quick and efficient.
Doing this messes up the file because it seems to ignore '\n'
ifstream in("somefile");
ofstream out("someOtherFile");
std::copy(std::istream_iterator<unsigned char>(in),
|
by: Beryl Small |
last post by:
I have a web application in Visual Studio.Net 2003. On the click event of a button on my .aspx page, I use the following
FileCopy SourceFile, DestinationFil
the Sourcefile is on a mapped drive (s:\) on the server it returns the error "File not found" even though the file is there. The same code in the same place works fine if the file is on the c:\ drive. Same code also works fine with the mapped server drive in .NET if a put it in a...
|
by: deko |
last post by:
In a multi-user environment, I have a table that stores hyperlinks to
documents that are stored on the machine that hosts the mdb database. The
table entry looks like this:
ProductDescription.htm#file:\\DBHOST\C$\Documents and
Settings\Administrator\My
Documents\Products\Documents\ProductDescription.htm
Having the hyperlink in this format allows the document to be opened by
anyone on the local area network.
|
by: cantelow |
last post by:
Hi. I've got a program printing multiple pdf reports, and I need to
wait for completion of various associated operations- The pdf printer
prints to one file, then I need to copy that where I need it, then
delete the old file, repeat with the next report. I need to wait for
each step to complete or I get errors due to the previous thing being
open and not done yet.
Is there any elegant way to do that? My FileCopy in particular has...
|
by: Lou |
last post by:
I have a file name witha wildcard:
"D:\myFolder\Logo1.*tga"
There are 50 files that match this wilcard.
I want to copy these 50 files to another directory
I Tried
FileCopy("D:\myFolder\Logo1.*tga","D:\TargetDir")
but that didnt work?
| |
by: daniele.balducci |
last post by:
Hi All, I'm experiencing troubles in a simple .net web application. The
applicatione is made up by a single form looping to move some files to a
different folder .
the main loop is as follows :
C
Const CurrUploadDir= .....
Const CurrSentDir= .....
Dim CurFile as string
CurFile = Dir(CurrUploadDir & "*.*")
|
by: =?Utf-8?B?UnVpIE9saXZlaXJh?= |
last post by:
Where can I find XP version of FILECOPY.AVI, to use in a dialog?
There is a movie called FILECOPY.AVI which is included with Visual
Studio 2005, but it is the 16 bit (Windows 95) version. There are a
few other videos in the same directory that look like the 32 bit
versions.
My question is: Where can I find a 32 bit (XP style) version of this
video? I know it exists because if I copy files in XP, I get a
different animation, with...
|
by: bhughes2187 |
last post by:
In my app I am creating, there is a procedure that does a file copy from the local drive to a network share. The issue I am having, is even though I have the share mapped, and I can browse to the share with no problems, when ever the procedure is run, I get a Permission Denied error.
When I get this error, I click on Debug and find the line causing the error which is my file copy line. If I click continue, the code sequence finishes and the...
|
by: TracyWants2Know |
last post by:
Access Version: 2002 SP3
OS: MS Windows XP Professional
Code from Module:
Dim txtFileNameBuES As String
Dim txtFileNameBuESXP As String
Dim txtPathNameBuTo As String
txtFileNameBuES = DLookup("", "Variables")
txtFileNameBuESXP = DLookup("", "Variables")
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |