Yes, you need to use an external website.
For example with Wininet on my PC :
HINTERNET hInternet = InternetOpen(NULL, INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY, NULL, NULL, 0);
if (hInternet != NULL)
{
HINTERNET hFile = InternetOpenUrl(hInternet, _T("https://api.ipify.org"), NULL, 0, INTERNET_FLAG_RELOAD, 0);
if (hFile != NULL)
{
CHAR sBuffer[MAX_PATH];
TCHAR wsBuffer[MAX_PATH];
DWORD nRead;
BOOL bRet = InternetReadFile(hFile, sBuffer, sizeof(sBuffer), &nRead);
if (bRet)
{
sBuffer[nRead] = '\0';
MultiByteToWideChar(CP_ACP, 0, sBuffer, -1, wsBuffer, MAX_PATH);
TCHAR wsMessage[MAX_PATH] = _T("");
wsprintf(wsMessage, _T("External IP : %s"), wsBuffer);
MessageBox(NULL, wsMessage, _T("Information"), MB_OK | MB_ICONINFORMATION);
}
InternetCloseHandle(hFile);
}
InternetCloseHandle(hInternet);
}