Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > microsoft.public.excel.programming > #110003
| From | "Peter T" <askformy@gmail.com> |
|---|---|
| Newsgroups | microsoft.public.excel.programming |
| Subject | Re: IP address to Hostname in Excel |
| Date | 2017-04-12 08:55 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <ockmch$pt8$1@dont-email.me> (permalink) |
| References | <#UrrP9T2KHA.4332@TK2MSFTNGP02.phx.gbl> <enCgQqj2KHA.4752@TK2MSFTNGP02.phx.gbl> <4e437bb8-74e6-4a87-b5d5-462b2d46956a@googlegroups.com> <ocfmc0$jlu$1@dont-email.me> <ec77b1d1-c335-4ecb-acbd-4d26b91f5ce5@googlegroups.com> |
<theurlofealing@googlemail.com> wrote in message news:ec77b1d1-c335-4ecb-acbd-4d26b91f5ce5@googlegroups.com... Sorry - I should have pointed out that the "CopyMemory" problem occurs on both 32 and 64 bit Office IF running on 64-bit Windows. I'm familiar with the PtrSafe construct but I've tried adjusting the data types (LongPtr, LongLong, etc) without success. I also emailed Randy who said he'd never tried to make it work on 64-bit OS. Another source said that anything using winsock32.dll on 64 bit OS won't work reliably, but I don't know if that is true. You can get a Name from an IP using WMI but if the remote computer isn't listening on WMI the code waits a long-time before giving up, which is no good if its along list of computers, and they may not all be running Windows! I can only reiterate Randy's original works fine for me in Win10 + Excel64 the with the usual adaptations for the APIs. Without knowing what you've changed hard to suggest why yours crashes. All the APIs should be declared with PtrSafe. The gethostbyaddr function should return a LongPtr and its hAddr argument should be a LongPtr In Randy's GetHostNameFromIP function ptrHosent and hAddress should be LongPtr If you need to cater for Office 2007 or earlier you'll need to include the differences for both APIs and declared variables (in your own functions) under #IfVBA7 ptrSafe LongPtr version.. #Else original code. #End If In passing don't declare as LongLong unless you're coding exclusively for Office64 or under #Win64.Under VBA7 LongPtr is a Long in x32 and a LongLong in x64. Another tip, look for arguments in APIs starting with h (or hwnd) or include ptr. Handles and pointers are LongPtr (ie LongLong in x64) and variables that pass or return such values should be declared as LongPtr. APIs that return similar will return a LongPtr, and should be returned to appropriately declared variables. Head your module Option Explicit and do Debug / compile in both x32 and x64 In 32 bit Office Randy's original should work fine as-is even in 64bit Windows. Make sure you copy it directly from his site. All you need to do is change the two text-box references to strings. Peter T
Back to microsoft.public.excel.programming | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: IP address to Hostname in Excel theurlofealing@googlemail.com - 2017-04-10 01:14 -0700
Re: IP address to Hostname in Excel "Peter T" <askformy@gmail.com> - 2017-04-10 11:25 +0100
Re: IP address to Hostname in Excel theurlofealing@googlemail.com - 2017-04-11 12:23 -0700
Re: IP address to Hostname in Excel "Peter T" <askformy@gmail.com> - 2017-04-12 08:55 +0100
Re: IP address to Hostname in Excel theurlofealing@googlemail.com - 2017-04-12 11:52 -0700
Re: IP address to Hostname in Excel "Peter T" <askformy@gmail.com> - 2017-04-13 09:44 +0100
Re: IP address to Hostname in Excel theurlofealing@googlemail.com - 2017-04-13 16:39 -0700
Re: IP address to Hostname in Excel Andrey G <andrey.gorodnichev2@gmail.com> - 2020-11-10 06:45 -0800
Re: IP address to Hostname in Excel "Peter T" <askmy@email.com> - 2020-11-10 17:26 +0000
Re: IP address to Hostname in Excel "Auric__" <not.my.real@email.address> - 2020-11-10 17:40 +0000
Re: IP address to Hostname in Excel "Peter T" <askmy@email.com> - 2020-11-11 10:16 +0000
Re: IP address to Hostname in Excel Andrey G <andrey.gorodnichev2@gmail.com> - 2020-11-10 10:54 -0800
Re: IP address to Hostname in Excel "Auric__" <not.my.real@email.address> - 2020-11-10 20:00 +0000
Re: IP address to Hostname in Excel "Peter T" <askmy@email.com> - 2020-11-11 11:39 +0000
Re: IP address to Hostname in Excel Andrey G <andrey.gorodnichev2@gmail.com> - 2020-11-11 04:11 -0800
Re: IP address to Hostname in Excel "Peter T" <askmy@email.com> - 2020-11-12 11:38 +0000
Re: IP address to Hostname in Excel Andrey G <andrey.gorodnichev2@gmail.com> - 2020-11-12 04:10 -0800
Re: IP address to Hostname in Excel "Peter T" <askmy@email.com> - 2020-11-18 10:02 +0000
Re: IP address to Hostname in Excel Andrey G <andrey.gorodnichev2@gmail.com> - 2020-11-18 13:25 -0800
Re: IP address to Hostname in Excel "Peter T" <askmy@email.com> - 2020-11-18 22:51 +0000
Re: IP address to Hostname in Excel Andrey G <andrey.gorodnichev2@gmail.com> - 2020-11-22 11:33 -0800
Re: IP address to Hostname in Excel "Peter T" <askmy@email.com> - 2020-11-23 14:37 +0000
Re: IP address to Hostname in Excel Andrey G <andrey.gorodnichev2@gmail.com> - 2020-11-24 01:50 -0800
Re: IP address to Hostname in Excel birchr@gmail.com - 2017-04-12 12:27 -0700
csiph-web