You have used incorrect HINTERNET
handle.
From Option Flags documentation:
INTERNET_OPTION_PROXY_USERNAME This option can be set on the handle returned by InternetConnect or HttpOpenRequest.
INTERNET_OPTION_PROXY_PASSWORD This option can be set on the handle returned by InternetConnect or HttpOpenRequest.
So, you must use InternetConnect()
or HttpOpenRequest()
.