0
C#에서 HtmlFile에 인수를 전달하는 방법은 무엇입니까?HtmlFile에 인수를 전달하는 방법은 무엇입니까?
처럼 : System.Diagnostics.Process.Start("Sample.html","Arguments");
나는 위의 코드를 실행하면 "Sample.html"파일을 열 수 있어야하고는 "인수"뭔가를해야한다.
C#에서 HtmlFile에 인수를 전달하는 방법은 무엇입니까?HtmlFile에 인수를 전달하는 방법은 무엇입니까?
처럼 : System.Diagnostics.Process.Start("Sample.html","Arguments");
나는 위의 코드를 실행하면 "Sample.html"파일을 열 수 있어야하고는 "인수"뭔가를해야한다.
Process.Start(
@"C:\Program Files\Internet Explorer\iexplore.exe",
"file:///c:/path/to/file/Sample.html?param1=value1"
);
UPDATE :
기본 브라우저의 위치를 파악하려면 : 올바른 표준 브라우저의 경로를 결정으로
class Program
{
[DllImport("shell32.dll")]
public extern static int FindExecutable(
string forFile,
string directory,
StringBuilder result
);
static void Main(string[] args)
{
var browserLocation = new StringBuilder(1024);
// make sure you specify the correct path and the file actually exists
// or the FindExecutable will return an empty string.
FindExecutable(@"d:\work\html\index.htm", null, browserLocation);
Process.Start(
browserLocation.ToString(),
"file:///d:/work/html/index.htm?param1=value1"
);
}
}
당신은 곧 하나를 얻을 수 있습니다. ;-) –
@Konrad, 내 업데이트 참조 : –
Darin Dimitrov – Pramodh