BOOL RegisterBrowserEmulationMode(BOOL bFocusMode)
{
	int nMajarVersion = GetIEVersion();
#ifdef DEBUG
	CString msgout;
	msgout.Format(L"当前IE主版本号为%d\n",nMajarVersion);
	OutputDebugStringW(msgout);
#endif
	if (nMajarVersion >=6 && nMajarVersion <= 12)
	{
		DWORD dwValue = 0;
		if ( nMajarVersion < 10 )
		{
			if(bFocusMode)
				dwValue = 1111*nMajarVersion;
			else
				dwValue = 1000*nMajarVersion;
		}
		else
		{
			if(bFocusMode)
				dwValue = 1000*nMajarVersion+1;
			else
				dwValue = 1000*nMajarVersion;
		}

		CString strExeName;
		GetModuleFileNameW(NULL,strExeName.GetBuffer(MAX_PATH),MAX_PATH);
		strExeName.ReleaseBuffer();

        strExeName = strExeName.Right(strExeName.GetLength() - strExeName.ReverseFind(L'\\')-1);
        RunAsFastMode(strExeName,dwValue);
        
        LPCTSTR pszName2 = strExeName.GetBuffer();
        LPCTSTR pszName3 = NULL;


        if(nMajarVersion>=7)
        {
            SetBrowserFeature(HKEY_CURRENT_USER,L"FEATURE_MAXCONNECTIONSPER1_0SERVER",strExeName,10,pszName2,pszName3);
            SetBrowserFeature(HKEY_CURRENT_USER,L"FEATURE_MAXCONNECTIONSPERSERVER",strExeName,10,pszName2,pszName3);
            SetBrowserFeature(HKEY_LOCAL_MACHINE,L"FEATURE_ACTIVEX_REPURPOSEDETECTION",strExeName,1,pszName2,pszName3);
            SetBrowserFeature(HKEY_LOCAL_MACHINE,L"FEATURE_BLOCK_LMZ_IMG",strExeName,1,pszName2,pszName3);
            SetBrowserFeature(HKEY_LOCAL_MACHINE,L"FEATURE_BLOCK_LMZ_OBJECT",strExeName,1,pszName2,pszName3);
            SetBrowserFeature(HKEY_LOCAL_MACHINE,L"FEATURE_BLOCK_LMZ_SCRIPT",strExeName,1,pszName2,pszName3);
            SetBrowserFeature(HKEY_LOCAL_MACHINE,L"FEATURE_Cross_Domain_Redirect_Mitigation",strExeName,1,pszName2,pszName3);
            SetBrowserFeature(HKEY_LOCAL_MACHINE,L"FEATURE_ENABLE_SCRIPT_PASTE_URLACTION_IF_PROMPT",strExeName,1,pszName2,pszName3);
            SetBrowserFeature(HKEY_LOCAL_MACHINE,L"FEATURE_GPU_RENDERING",strExeName,1,pszName2,pszName3);
            SetBrowserFeature(HKEY_LOCAL_MACHINE,L"FEATURE_LOCALMACHINE_LOCKDOWN",strExeName,1,pszName2,pszName3);
            SetBrowserFeature(HKEY_LOCAL_MACHINE,L"FEATURE_MAXCONNECTIONSPER1_0SERVER",strExeName,10,pszName2,pszName3);
            SetBrowserFeature(HKEY_LOCAL_MACHINE,L"FEATURE_MAXCONNECTIONSPERSERVER",strExeName,10,pszName2,pszName3);
        }
	}
	return TRUE;
}
Example #2
0
BOOL InformApp::InitInstance()
{
  InitCommonControls();
  CWinApp::InitInstance();
  theOS.Init();
  theOS.BufferedPaintInit();

  if (!AfxOleInit())
    return FALSE;
  if (!Scintilla_RegisterClasses(AfxGetInstanceHandle()))
    return FALSE;

  if (GetIEVersion() < 5.0)
  {
    CString msg;
    msg.Format("Internet Explorer version 5 or higher must be installed.");
    AfxMessageBox(msg,MB_ICONSTOP|MB_OK);
    exit(0);
  }
  CheckMSXML();

  SetRegistryKey("David Kinder");
  SetFonts();
  ReportHtml::SetIEPreferences(REGISTRY_PATH_BROWSER);

  // Set the HOME environment variable to the My Documents folder,
  // used by the Natural Inform compiler, and make sure directories
  // under My Documents exist.
  SetMyDocuments();

  // Discard any log file from a previous run
  /*::DeleteFile(m_home+LOG_FILE);*/

  // Install the protocol for inform: URLs
  m_protocol.Install(L"inform");
  CString dir = GetAppDir();
  m_protocol.AddDirectory(dir+"\\Documentation");
  m_protocol.AddDirectory(dir+"\\Documentation\\doc_images");
  m_protocol.AddDirectory(dir+"\\Documentation\\sections");
  m_protocol.AddDirectory(L"//Extensions",m_home+"\\Inform\\Documentation");
  m_protocol.AddDirectory(L"//Extensions",dir+"\\Documentation");

  // Find and create documentation for extensions
  FindExtensions();
  RunCensus(false);

  // Show the splash screen
  SplashScreen splash;
  splash.ShowSplash();

  // Only continue if a project has been opened
  if (AfxGetMainWnd() == NULL)
    return FALSE;
  return TRUE;
}