The Background:
I'm trying to write a windows program to serve as a client-side HTML viewer. Since the development IDE that I'm using (Code::Blocks v:13.12) doesn't come with a copy of winHTTP.lib, I had to download a copy of the Windows 10 SDK.
I then proceeded to write the following code:
#include <iostream>
#include <windows.h>
#include <...\Windows Kits\10\Include\10.0.10586.0\um\winhttp.h>
const LPCWSTR Agent = (wchar_t*)TEXT("User Agent");
const LPCWSTR Url = (wchar_t*)TEXT("www.google.com");
using namespace std;
int main()
{
// Declare Variables:
DWORD dwSize = 0;
DWORD dwDownloaded = 0;
LPSTR pszOutBuffer;
BOOL bResults = FALSE;
HINTERNET hSession = NULL,
hConnect = NULL,
hRequest = NULL;
// Use WinHttpOpen to obtain a session handle:
hSession = WinHttpOpen(Agent,
WINHTTP_ACCESS_TYPE_DEFAULT_PROXY,
WINHTTP_NO_PROXY_NAME,
WINHTTP_NO_PROXY_BYPASS, 0 );
// Specify an HTTP server.
if( hSession )
hConnect = WinHttpConnect( hSession, Url, INTERNET_DEFAULT_HTTPS_PORT, 0 );
// Create an HTTP request handle.
if( hConnect )
hRequest = WinHttpOpenRequest(hConnect, L"GET", NULL,
NULL, WINHTTP_NO_REFERER,
WINHTTP_DEFAULT_ACCEPT_TYPES,
WINHTTP_FLAG_SECURE );
/*
* <INCOMPLETE>
*/
// Terminate Process Successfully:
return EXIT_SUCCESS;
}
(Note: "...\Windows Kits\" is the path to my copy of the Windows SDK)
I then proceeded to link my program to the "winHTTP.lib" library.
The Problem:
Now, every time I try to compile my program, I get the following result:
In "...\Windows Kits\10\Include\10.0.10586.0\um\winhttp.h": fatal error: winapifamily.h: No such file or directory
It seems that for whatever reason, my compiler is unable to find this "winapifamily.h".
The Questions:
Is this a problem with the compiler, the Windows SDK, or have I made an error in my code?
How can I fix this? Do I need to install another copy of the winHTTP Library, or is there a more simple way for me to solve the problem?
Forgot To Mention:
I suspect that this might be a problem with the search path for my IDE not lining up with the Windows 10 SDK. Is this a reasonable conclusion to draw?