I have been looking at the example code from Microsoft for using WinHTTP over COM, see: https://docs.microsoft.com/en-us/windows/win32/winhttp/iwinhttprequest-open
The first few lines of the code are as follows:
#include <windows.h>
#include <stdio.h>
#include <objbase.h>
#include "httprequest.h"
#pragma comment(lib, "ole32.lib")
#pragma comment(lib, "oleaut32.lib")
// IID for IWinHttpRequest.
const IID IID_IWinHttpRequest =
{
0x06f29373,
0x5c5a,
0x4b54,
{0xb0, 0x25, 0x6e, 0xf1, 0xbf, 0x8a, 0xbf, 0x0e}
};
int main()
{
// Variable for return value
HRESULT hr;
// Initialize COM
hr = CoInitialize( NULL );
IWinHttpRequest * pIWinHttpRequest = NULL;
I am confused with the correct way to #include the IWinHttpRequest type. I think it comes from the httprequest.h file which is not a system include file.
Also, I guess httprequest.h is the result of compiling httprequest.idl. Am I supposed to manually compile httprequest.idl, or as this is part of the Windows SDK is there a better way to access this type?