On Wednesday, November 18, 2020 at 10:02:17 AM UTC, Peter T wrote:
"Andrey G" wrote in message
...
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
Sorry to take a while to get back, I got hijacked with work!
In your original code, as well as changing the lengths of the 3 pointers
from 4 to 8, also change
ptrAddress = ptrHosent + 12 ' 3x4
to
ptrAddress = ptrHosent + 24 ' 3x8
Peter T
No joy, I'm afraid - Excel is still crashing on the very same line.
I wonder if I made an error in declarations? The code I'd posted above is the exact code I'm using.
Andrey G