2017년 11월 5일 일요일
시샵에서 windows xp 환경에서도 돌아가게 플랫폼 대상 설정 x86
시샵에서 windows xp 환경에서도 돌아가게 플랫폼 대상 설정 x86
any cpu
x64 vista 이상 버전
x86 windows xp이하 버전들
이외 사항이 있을 수 있어요
2017년 10월 15일 일요일
c#에서 webbrowser 적용시 Internet explorer의 버전 올리기 [현재 시스템에서 사용중인 버전으로 수정하기]
c#에서 webbrowser 적용시 Internet explorer의 버전 올리기 [현재 시스템에서 사용중인 버전으로 수정하기]
기본적으로 시샵에서 Internet Explorer 7 버전이 탑재되어 있어요
몇년도에 만들어진 버전인지 모르지만 아주 오래된 버전이고, 현재 시점에는 Internet Explorer 11점 대가 사용되고 있어요
수정하기 위해서는 레지스트리 값을 수정해 주셔야 해요
소스)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
//웹브라우저 레지스트리 등록하는 부분
//(x) http://guideme.tistory.com/1
//(ㅇ) http://okgood0412.tistory.com/entry/C-WebBrowser-version-%EB%B3%80%EA%B2%BD
using System.Security;
using Microsoft.Win32;
using System.IO;
using System.Threading;
using System.Diagnostics;
namespace Test5
{
static class Program
{
static Mutex mutex = new System.Threading.Mutex(false, "jMutex");
/// <summary>
/// 해당 응용 프로그램의 주 진입점입니다.
/// </summary>
[STAThread]
static void Main()
{
//SetBrowserEmulationVersion();
if (!mutex.WaitOne(TimeSpan.FromSeconds(2), false))
{
//another application instance is running
return;
}
try
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
var targetApplication = Process.GetCurrentProcess().ProcessName + ".exe";
int browserver = 7;
int ie_emulation = 11999;
using (WebBrowser wb = new WebBrowser())
{
browserver = wb.Version.Major;
if (browserver >= 11)
ie_emulation = 11001;
else if (browserver == 10)
ie_emulation = 10001;
else if (browserver == 9)
ie_emulation = 9999;
else if (browserver == 8)
ie_emulation = 8888;
else
ie_emulation = 7000;
}
try
{
//string tmp = Properties.Settings.Default.Properties.
SetIEVersioneKeyforWebBrowserControl(targetApplication, ie_emulation);
Application.Run(new Form1());
}
catch (Exception ex1)
{
}
}
catch (Exception ex2)
{
}
finally
{
mutex.ReleaseMutex();
}
}
private static void SetIEVersioneKeyforWebBrowserControl(string appName, int ieval)
{
RegistryKey Regkey = null;
try
{
Regkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", true);
//If the path is not correct or
//If user't have priviledges to access registry
if (Regkey == null)
{
MessageBox.Show("Application FEATURE_BROWSER_EMULATION Failed - Registry key Not found");
return;
}
string FindAppkey = Convert.ToString(Regkey.GetValue(appName));
//Check if key is already present
if (FindAppkey == ieval.ToString())
{
MessageBox.Show("Application FEATURE_BROWSER_EMULATION already set to " + ieval);
Regkey.Close();
return;
}
//If key is not present or different from desired, add/modify the key , key value
Regkey.SetValue(appName, unchecked((int)ieval), RegistryValueKind.DWord);
//check for the key after adding
FindAppkey = Convert.ToString(Regkey.GetValue(appName));
if (FindAppkey == ieval.ToString())
{
MessageBox.Show("Application FEATURE_BROWSER_EMULATION changed to " + ieval + "; changes will be visible at application restart");
}
else
{
MessageBox.Show("Application FEATURE_BROWSER_EMULATION setting failed; current value is " + ieval);
}
}
catch (Exception ex)
{
MessageBox.Show("Application FEATURE_BROWSER_EMULATION setting failed; " + ex.Message);
}
finally
{
//Close the Registry
if (Regkey != null)
Regkey.Close();
}
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
} // end main();
}
}
2017년 10월 13일 금요일
c# 시샵에서 구글 크롬브라우저 띄우기 ( google chrome browser )
c# 시샵에서 구글 크롬브라우저 띄우기
1) 비주얼 스튜디오 커뮤니티 버전으로 시샵으로 프로젝트 생성
Visual studio community
Cefsharp 라이브러리 추가
2) 설정사항
닷넷 프레임워크 4.5.2 이상으로 실행 (.Net Framework 4.5 higher )
cpu x64로 실행
3) 기본적으로 영어로 실행
언어셋 변경
여러가지는 해보시면서 업데이트 하세요~
have a nice day~
피드 구독하기:
글 (Atom)


