728x90
반응형
728x170
▶ WebBrowser 클래스 : Internet Explorer 버전 11 사용하기 예제
using System.Diagnostics;
string applicationFileName = $"{Process.GetCurrentProcess().ProcessName}.exe";
SetRegistryKeyForWebBrowserControl(applicationFileName);
※ 관리자 권한으로 실행해야 한다.
728x90
▶ WebBrowser 클래스 : Internet Explorer 버전 11 사용하기
using Microsoft.Win32;
using System;
#region 웹 브라우저 컨트롤용 레지스트 키 설정하기 - SetRegistryKeyForWebBrowserControl(applicationFileName)
/// <summary>
/// 웹 브라우저 컨트롤용 레지스트 키 설정하기
/// </summary>
/// <param name="applicationFileName">애플리케이션 파일명</param>
/// <returns>처리 결과</returns>
/// <remarks>WebBrowser 컨트롤을 Internet Explorer 11 버전으로 동작하도록 해준다.</remarks>
public bool SetRegistryKeyForWebBrowserControl(string applicationFileName)
{
RegistryKey registryKey = null;
try
{
registryKey = Registry.LocalMachine.OpenSubKey
(
@"SOFTWARE\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION",
true
);
if(registryKey == null)
{
return false;
}
string registryKeyValue = Convert.ToString(registryKey.GetValue(applicationFileName));
if(registryKeyValue == "11001")
{
registryKey.Close();
return true;
}
if(string.IsNullOrEmpty(registryKeyValue))
{
registryKey.SetValue(applicationFileName, unchecked((int)0x2AF9), RegistryValueKind.DWord);
}
registryKeyValue = Convert.ToString(registryKey.GetValue(applicationFileName));
if(registryKeyValue == "11001")
{
return true;
}
else
{
return false;
}
}
catch(Exception)
{
return false;
}
finally
{
if(registryKey != null)
{
registryKey.Close();
}
}
}
#endregion
728x90
반응형
그리드형(광고전용)
'C# > WinForm' 카테고리의 다른 글
[C#/WINFORM] 마우스 드래그 대상 이미지 표시하기 (0) | 2021.12.06 |
---|---|
[C#/WINFORM] 카카오 링크를 사용해 나에게 카카오톡 메시지 보내기 (기능 개선) (0) | 2021.11.24 |
[C#/WINFORM] 누겟 설치 : CefSharp.WinForms (0) | 2021.11.23 |
[C#/WINFORM] 누겟 설치 : CefSharp.Common (0) | 2021.11.23 |
[C#/WINFORM] WebBrowser 클래스 : Internet Explorer의 브라우저 에뮬레이션 모드 구하기 (0) | 2021.11.23 |
[C#/WINFORM] 카카오 링크를 사용해 나에게 카카오톡 메시지 보내기 (기능 개선) (0) | 2021.11.23 |
[C#/WINFORM] 카카오 링크를 사용해 나에게 카카오톡 메시지 보내기 (0) | 2021.11.23 |
[C#/WINFORM] PrintWindow API 함수를 사용해 윈도우 비트맵 구하기 (0) | 2021.11.14 |
[C#/WINFORM] 3D 차트 사용하기 (0) | 2021.10.22 |
[C#/WINFORM] 가상 데스크톱 전환하기 (0) | 2021.09.10 |
댓글을 달아 주세요