my requirement is Ethernet with self test module using pining programs if any one have idea just let me know or help me out
What I have tried:
/*.cpp*/
#include "pch.h"
#include "MGTS.h"
#include "CUtilitiesTab.h"
#include "afxdialogex.h"
#define STRICT
#include <tchar.h>
#include <windows.h>
#include <winsock2.h>
#include <iphlpapi.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#define WIN32_LEAN_AND_MEAN
void CUtilitiesTab::OnBnClickedCheck2()
{
<pre>int rc;
IPAddr ia;
MessageBeep(1000);
UpdateData(TRUE);
ia = inet_addr(m_ip_address);
rc = NewPing(ia, (ULONG*)&m_hops_count, (ULONG*)&m_rtt);
if (rc == 0)
m_selftestresult.SetWindowTextW(_T("pass"));
else
m_selftestresult.SetWindowTextW(_T("Host not responding or no route, rc = %d", rc));
UpdateData(FALSE);
MessageBeep(1000);
return;
}
/*.h*/ hearder file
class CUtilitiesTab : public CDialogEx
{
DECLARE_DYNAMIC(CUtilitiesTab)
public:
CUtilitiesTab(CWnd* pParent = nullptr);
virtual ~CUtilitiesTab();
#ifdef AFX_DESIGN_TIME
enum { IDD = IDD_UTILITIES };
#endif
protected:
HICON m_hIcon;
virtual BOOL OnInitDialog();
virtual void DoDataExchange(CDataExchange* pDX);
DECLARE_MESSAGE_MAP()
public:
IPHLPAPI_DLL_LINKAGE BOOL GetRTTAndHopCount(
IPAddr DestIpAddress,
PULONG HopCount,
ULONG MaxHops,
PULONG RTT
);
CString m_ip_address[4];
long m_hops_count;
long m_rtt;
afx_msg void OnBnClickedCheck2();
};
I am geting below error ,but when i put
#pragma warning(disable:4996)
it will remove the below error .
Error C4996 'inet_addr': Use inet_pton() or InetPton() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings MGTS
as if now i am geting this error ..
S
Error LNK2019 unresolved external symbol __imp__GetRTTAndHopCount@16 referenced in function "int __cdecl NewPing(unsigned long,unsigned long *,unsigned long *)" (?NewPing@@YAHKPAK0@Z 1
please someone help me'