NDF Diagnostics Example
The following example shows how to launch the NDF user interface and diagnose connectivity to the website https://www.microsoft.com.
#include "ndfapi.h"
NDFHANDLE hNDF;
HRESULT hr = NdfCreateWebIncident (
L"https://www.microsoft.com",
&hNDF);
if(SUCCEEDED(hr))
{
NdfExecuteDiagnosis(hNDF, NULL); // launches the NDF UI
// the UI is not modal to the original window
NdfCloseIncident(hNDF);
}
The NDF UI can be launched as a modal window. To do so, change the second parameter of NdfExecuteDiagnosis from NULL to the handle (HWND) of the parent window.
This example can be modified to diagnose other areas of networking. To do so, replace the NdfCreateWebIncident call with one of the other incident creation functions, such as NdfCreateDNSIncident or NdfCreateWinSockIncident.
Related topics