黑
黑猫白猫
Unregistered / Unconfirmed
GUEST, unregistred user!
BOOL NotifyIPChange(LPCTSTR lpszAdapterName, int nIndex, LPCTSTR pIPAddress, LPCTSTR pNetMask)<br>{<br> BOOL bResult = FALSE;<br> HINSTANCE hDhcpDll;<br> DHCPNOTIFYPROC pDhcpNotifyProc;<br> WCHAR wcAdapterName[256];<br> <br> MultiByteToWideChar(CP_ACP, 0, lpszAdapterName, -1, wcAdapterName,256);<br><br> if((hDhcpDll = LoadLibrary("dhcpcsvc") == NULL)<br> return FALSE;<br><br> if((pDhcpNotifyProc = (DHCPNOTIFYPROC)GetProcAddress(hDhcpDll, "DhcpNotifyConfigChange") != NULL)<br> if((pDhcpNotifyProc)(NULL, wcAdapterName, TRUE, nIndex, inet_addr(pIPAddress), inet_addr(pNetMask), 0) == ERROR_SUCCESS)<br> bResult = TRUE;<br><br> FreeLibrary(hDhcpDll);<br> return bResult;<br>}