You are currently offline, waiting for your internet to reconnect

Your browser is out-of-date

You need to update your browser to use the site.

Update to the latest version of Internet Explorer

You receive an "ERROR_FILE_NOT_FOUND" error message when you try to use the WinHttpGetIEProxyConfigForCurrentUser function

SYMPTOMS
If your computer has never run Microsoft Internet Explorer and you use the WinHttpGetIEProxyConfigForCurrentUser function in any program, you receive the following error message:
ERROR_FILE_NOT_FOUND
CAUSE
The WinHttpGetIEProxyConfigForCurrentUser function uses the following registry subkey:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings
This registry subkey is created the first time that Internet Explorer runs. If your computer has not run Internet Explorer, this registry subkey does not exist. When you call the WinHttpGetIEProxyConfigForCurrentUser function in a program, the function searches for this registry entry and cannot find it, and you receive the error message.
RESOLUTION
To resolve this problem, start Internet Explorer, and then use the WinHttpGetIEProxyConfigForCurrentUser function in any program.
MORE INFORMATION

Steps to reproduce the problem

  1. Log on to a computer where Internet Explorer has never been used.
  2. Start Microsoft Visual Studio .NET.
  3. On the File menu, point to New, and then click Project.
  4. Under Project Types, click Visual C++ Projects.
  5. Under Templates, click Win32 Project.
  6. In the Name box, type Test, and then click OK.
  7. On the Welcome to the Win32 Application Wizard page, click Application Settings.
  8. Under Application type, click Console application, and then click Finish.

    The Test.cpp file is created.
  9. Replace the existing code in the Test.cpp file with the following code:
    #include "stdafx.h"#include <Windows.h>#include <Winhttp.h>using namespace std;void main(){	WINHTTP_CURRENT_USER_IE_PROXY_CONFIG MyProxyConfig;	if(!WinHttpGetIEProxyConfigForCurrentUser(&MyProxyConfig))	{		//check the error		DWORD Err = GetLastError();		cout << "WinHttpGetIEProxyConfigForCurrentUser failed with the following error number: " << Err << endl;		switch (Err)		{			case ERROR_FILE_NOT_FOUND:				cout << "The error is ERROR_FILE_NOT_FOUND" << endl;				break;			case ERROR_WINHTTP_INTERNAL_ERROR:				cout << "ERROR_WINHTTP_INTERNAL_ERROR" << endl;				break;			case ERROR_NOT_ENOUGH_MEMORY:				cout << "ERROR_NOT_ENOUGH_MEMORY" << endl;				break;			default:				cout << "Look up error in header file." << endl; 		}//end switch	}//end if	else	{		//no error so check the proxy settings and free any strings		cout << "Auto Detect is: " << MyProxyConfig.fAutoDetect << endl;		if(NULL != MyProxyConfig.lpszAutoConfigUrl)		{			wcout << "AutoConfigURL is: " << MyProxyConfig.lpszAutoConfigUrl << endl;			GlobalFree(MyProxyConfig.lpszAutoConfigUrl);		}		if(NULL != MyProxyConfig.lpszProxy)		{			wcout << "AutoConfigURL is: " << MyProxyConfig.lpszProxy << endl;			GlobalFree(MyProxyConfig.lpszProxy);		}		if(NULL != MyProxyConfig.lpszProxyBypass)		{			wcout << "AutoConfigURL is: " << MyProxyConfig.lpszProxyBypass << endl;			GlobalFree(MyProxyConfig.lpszProxyBypass);		}	}//end else	cout << "finished!";}//end main
    Note The Winhttp.h file and the Winhttp.lib file are included in the Microsoft Platform software development kit (SDK). To download the Platform SDK, visit the following Microsoft Web site:
  10. On the Project menu, click Test Properties.
  11. In the left pane, double-click Linker.
  12. Under Linker, click Input.
  13. In the right pane, type winhttp.lib in the Additional Dependencies field, and then click OK.
  14. On the Build menu, click Build Solution.
  15. Press CTRL+F5 to run the program without the debugger.

    You receive the error message that is mentioned in the "Symptoms" section.
REFERENCES
For more information, visit the following Microsoft Developer Network (MSDN) Web site:
Properties

Article ID: 873200 - Last Review: 01/11/2007 09:18:15 - Revision: 1.2

  • Microsoft Windows HTTP Services 5.1
  • kberrmsg kbprb kbhttp kbsettings kbconfig kbtshoot KB873200
Feedback
;did=1&t=">l>