Automatic Configuration Samples

Other versions of this page are also available for the following:

Windows Mobile Not SupportedWindows Embedded CE Supported

8/28/2008

%_WINCEROOT%\Public\common\oak\drivers\netui\wzcui.c, contains sample code which uses the Zero Comfi API data to populate a dialog box, as well as using the UI to re-populate this data.

%_WINCEROOT%\Public\ommon\oak\drivers\netui\wzcquickcfgui.c, contains the sample code for the ethman UI. Ethman updates the UI much more frequently than the dialog in wzcui.c. This UI may be more practical for portable devices where networks are changing more frequently. Ethman periodically calls WZCRefreshInterfaceand updates the UI to allow users to see updated visible network activity.

Below is a snippet from the NETUI code that is used by ethman.dll to populate its simple wireless dialog box. The snippet shows is how it uses the rdBSSIDList to show visible networks and rdStSSIDList for the preferred networks.

HRESULT RefreshWirelessInfo(HWND hwndDlg)
{
HRESULThr = S_OK;
DWORDdwError= ERROR_SUCCESS;
SystrayIcon*pSysIcon = NULL;

// Get the systray icon for the given window
hr = GetDeviceSystrayIcon(hwndDlg, &pSysIcon);
if(FAILED(hr) || !pSysIcon)
{
DEBUGMSG(ZONE_ERROR, (TEXT("NETUIQC: Error getting systray icon struct")));
goto exit;
}

// If the zero config data has already been deleted then do not bother to delete it. This should not really ever get called but let's check just in case. If it ever does get hit, the refresh thread will exit quietly andthings should resume ok the next time around.
if(pSysIcon->WLanInfo.IntfEntry.bInitialized == FALSE)
{
hr = E_FAIL;
goto exit;
}

pfnWZCDeleteIntfObj(&pSysIcon->WLanInfo.IntfEntry);

pSysIcon->WLanInfo.IntfEntry.wszGuid = pSysIcon->ptcDeviceName;

// GetWireless Info
if ((dwError = pfnWZCQueryInterface(
                    NULL,
                    INTF_ALL,
                    &pSysIcon->WLanInfo.IntfEntry,
                    &pSysIcon->WLanInfo.dwOIDFlags)) != ERROR_SUCCESS) 
{
        DEBUGMSG(ZONE_ERROR,(TEXT("NETUIQC: WZCQueryInterface failed 0x%X\r\n"),dwError));
        hr = E_FAIL;
        goto exit;
}

FillVisibleList(&pSysIcon->WLanInfo,(PWZC_802_11_CONFIG_LIST)pSysIcon->WLanInfo.IntfEntry.rdBSSIDList.pData);
FillPreferredList(&pSysIcon->WLanInfo,(PWZC_802_11_CONFIG_LIST)pSysIcon->WLanInfo.IntfEntry.rdStSSIDList.pData);
FillCurrentConfig(&pSysIcon->WLanInfo,&pSysIcon->WLanInfo.IntfEntry);

exit:

return hr;

} // RefreshWirelessInfo

See Also

Reference

Automatic Configuration Functions

Other Resources

Using the Windows Zero Config API