using System.IO; // File.
using System.Diagnostics; // Process.
private void button3_Click(object sender, EventArgs e)
{
string sFileHTA = C:\Users\dattatray\Desktop\UPS\RatingToolGenSource\RatingTool.hta";
string sErr = "";
sErr = Open_HTA(sFileHTA);
if (sErr != "")
{
MessageBox.Show(sErr);
}
}
// Open an HTML Application.
private string Open_HTA(string sFileName_hta)
{
string sErr = "";
if (File.Exists(sFileName_hta) == false)
{
return "Application not found.";
}
try
{
Process p = new Process();
p.StartInfo.UseShellExecute = true;
p.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
p.StartInfo.ErrorDialog = true;
p.StartInfo.FileName = sFileName_hta;
p.Start();
p.Dispose();
}
catch (Win32Exception ex)
{
sErr = ex.Message;
}
return sErr;
}
Hello,
ReplyDeleteThank you for this post. It was really very helpful.
I would like to know if anything can be done to remove the popup appearing when the hta file opens saying run/save/cancel.
Instead it should automatically run without asking user for an option to run/save/cancel.
this will completely solve my problem.
please help.