View Single Post
  #40   Report Post  
Posted to microsoft.public.excel.programming
Andrey G Andrey G is offline
external usenet poster
 
Posts: 7
Default IP address to Hostname in Excel

On Thursday, November 12, 2020 at 11:37:20 AM UTC, Peter T wrote:
"Andrey G" wrote in message
Hi Peter,

I've tried running code with the last argument for CopyMemory changed, but
Excel still crashed. Please have a look below at the details of the
problem:

[snip]
'get the IP address
CopyMemory ptrAddress, ByVal ptrAddress, 8 '<----- Excel crashes
on this line!
CopyMemory ptrIPAddress, ByVal ptrAddress, 8
CopyMemory ptrIPAddress2, ByVal ptrIPAddress, 8

GetIPFromHostName = GetInetStrFromPtr(ptrIPAddress2)

End If

End Function

Hmm, not sure where the root of the problem is, though for me it crashes on
the second CopyMemory, I need to get the rest of the original example. I'll
try and look at it over the W/E.

Peter T



Hi Peter,
Thank you very much for looking into it!
Just to be absolutely clear:
As I'd said I've inherited the file, using original code from he http://vbnet.mvps.org/index.html?cod...byhostname.htm
Above I've posted simplified original code from he http://vbnet.mvps.org/index.html?cod...k/iplookup.htm
In my case, Excel crashes on both occasions on CopyMemory line of Function GetIPFromHostName().
KR
Andrey