#include <windows.h> #include <wininet.h> #include <stdio.h> #pragma comment(lib, "wininet.lib") int main() { HINTERNET hInternetSession = InternetOpen(L"MyApp", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0); if (hInternetSession != NULL) { HINTERNET hUrlHandle = InternetOpenUrl(hInternetSession, L"https://www.google.com/?hl=ja", NULL, 0, INTERNET_FLAG_RELOAD, 0); if (hUrlHandle != NULL) { char szBuffer[1024]; DWORD dwBytesRead = 0; while (InternetReadFile(hUrlHandle, szBuffer, sizeof(szBuffer), &dwBytesRead) && dwBytesRead) { printf("%.*s", dwBytesRead, szBuffer); } InternetCloseHandle(hUrlHandle); } else { printf("Failed to open URL\n"); } InternetCloseHandle(hInternetSession); } else { printf("Failed to initialize WinINet\n"); } return 0; }