I need to call the ping32.dll library from within an innosetup code section, which uses pascal. Problem is I don't know pascal and do not know how to call a dll.
There is an example of pascal in Innosetup calling an ODBC dll at http://www13.brinkster.com/vincenzog/isxart.asp?idart=52
The DLL call is defined in VB as follows (zip file that includes the ping32.dll package at http://www.winnetmag.com/Files/562/562.zip
Declare Function ping _
Lib "ping32.dll" _
(ByVal sHostName$, _
ByVal sIPAddr$, _
ByVal iDataLen%, _
ByVal iTimeout%, _
ByVal iVerbose%) As Integer
With the following writeup:
The first parameter of the ping function is a string containing either the name or the IP address of the system to be pinged. The second parameter is a string that the ping function returns. This string contains the IP address of the pinged system. This parameter lets the calling program retrieve the IP address for a given TCP/IP host name. The third parameter specifies the size of the data packet sent with the ping. The maximum data length that ping32.dll allows is 1024 bytes. The fourth parameter, a long variable, returns the elapsed milliseconds the ping function required to execute. The fifth parameter contains the maximum time in milliseconds that the ping function waits for a response for sent or received packets. The sixth parameter specifies the mode of operation for the ping function. If you set this parameter to True, ping32.dll runs in verbose mode, the mode that displays all ping results and errors in a message box. Setting the sixth parameter to False runs ping32.dll in silent mode, the mode that reports any ping results and errors in the ping function's return code and output parameters.
My last attempt was to call ping.exe directly as follows:
procedure TestOnClick(Sender: TObject);
WizardForm.Enabled := false;
sArgs := '-n 1 ' + txtIPaddress.Text;
bReturn := InstExec('ping.exe','-n 1' + IPaddress,'',True,False,SW
WizardForm.Enabled := true;
I just want to show a yes/no messagebox to inform the user as to whether the IP they provided is live.