毕业设计,急待您的帮助 通过vc6打开.c文件:Process.Start("work1.c",C:/Program Files/Microsoft Visual Studio/COMMON/MSDev98/Bin/MSDEV.EXE);以上这个方法在windows应用程序上已经能够实现了。现在,我做的是网站系统,想通过网页的形式来调用 vc6程序来打开.c文件还望高手指点指点.......! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 请问:通过vc6打开.c文件: Process.Start( "work1.c ",C:/Program Files/Microsoft Visual Studio/COMMON/MSDev98/Bin/MSDEV.EXE); 以上这个方法在windows应用程序上已经能够实现了。 现在,我做的是网站系统,想通过网页的形式来调用 vc6程序来打开.c文件 还望高手指点指点.......!webservice是什么东西呢? //如果调用系统自带程序,比如记事本可以这样System.Diagnostics.Process.Start("notepad.exe"); 你这个是调用算外部程序,所以给你如下代码参考: /// <summary>/// 运行外部程序/// </summary>/// <param name="exeName">程序路径</param>/// <returns>0:失败,1:成功</returns>public bool RunIt( string exeName ){//声明一个程序信息类System.Diagnostics.ProcessStartInfo Info = new System.Diagnostics.ProcessStartInfo();//设置外部程序名Info.FileName = exeName;//声明一个程序类try{System.Diagnostics.Process Proc ;Proc = System.Diagnostics.Process.Start(Info);return true;}catch{return false;}}/// <summary>/// 判断是否运行/// </summary>/// <param name="exeName">程序名</param>/// <returns>0:没运行,1:运行中</returns>public bool IsRun( string exeName ){string isrunning = "0";Process[] myProcesses = Process.GetProcesses();foreach(Process myProcess in myProcesses){if ( myProcess.ProcessName == exeName ){isrunning = "1";break;}}if ( isrunning == "1" ){return true;}else{return false;}} /// <summary>/// 结束进程/// </summary>/// <param name="exeName">进程名</param>/// <returns>0:失败,1:成功</returns>public bool Kill( string exeName ){string isrunning = "0";Process[] myProcesses = Process.GetProcesses();foreach(Process myProcess in myProcesses){if ( myProcess.ProcessName == exeName ){try{myProcess.Kill();isrunning = "1";}catch{isrunning = "0";}break;}}if ( isrunning == "1" ){return true;}else{return false;}}///////////////////////////////using System;using System.Diagnostics;namespace ZZ{ /// <summary> /// CmdUtility 的摘要说明。 /// </summary> public class CmdUtility { //private Process process; /// <summary> /// 构造函数 /// </summary> public CmdUtility() { //this.process = new Process(); } /// <summary> /// 执行单条命令 /// </summary> /// <param name="commandText">命令文本</param> /// <returns>命令输出文本</returns> public static string ExeCommand(string commandText) { Process p = new Process(); p.StartInfo.FileName = "cmd.exe"; p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardInput = true; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.RedirectStandardError = true; p.StartInfo.CreateNoWindow = true; string strOutput = null; try { p.Start(); p.StandardInput.WriteLine(commandText); p.StandardInput.WriteLine("exit"); //string formats = s.Replace("\r","").Replace("\n","\r\n"); strOutput = p.StandardOutput.ReadToEnd(); p.WaitForExit(); p.Close(); } catch(Exception e) { strOutput = e.Message; } return strOutput; } /// <summary> /// 执行多条命令 /// </summary> /// <param name="commandArray">命令文本数组</param> /// <returns>命令输出文本</returns> public static string ExeCommand(string [] commandTexts) { Process p = new Process(); p.StartInfo.FileName = "cmd.exe"; p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardInput = true; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.RedirectStandardError = true; p.StartInfo.CreateNoWindow = true; string strOutput = null; try { p.Start(); foreach(string item in commandTexts) { p.StandardInput.WriteLine(item); } p.StandardInput.WriteLine("exit"); strOutput = p.StandardOutput.ReadToEnd(); p.WaitForExit(); p.Close(); } catch(Exception e) { strOutput = e.Message; } return strOutput; } /// <summary> /// 启动外部应用程序 /// </summary> /// <param name="appName">应用程序路径名称</param> /// <returns>true表示成功,false表示失败</returns> public static bool StartApp(string appName) { bool blnRst = false; Process p = new Process(); p.StartInfo.FileName = appName;//exe,bat and so on p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; try { p.Start(); p.WaitForExit(); p.Close(); //while (!p.HasExited) //{ // Thread.Sleep(1000); //} blnRst = true; } catch { } return blnRst; } /// <summary> /// 启动外部应用程序 /// </summary> /// <param name="appName">应用程序路径名称</param> /// <param name="style">进程窗口模式</param> /// <returns>true表示成功,false表示失败</returns> public static bool StartApp(string appName,ProcessWindowStyle style) { bool blnRst = false; Process p = new Process(); p.StartInfo.FileName = appName;//exe,bat and so on p.StartInfo.WindowStyle = style; try { p.Start(); p.WaitForExit(); p.Close(); blnRst = true; } catch { } return blnRst; } /// <summary> /// 启动外部应用程序 /// </summary> /// <param name="appName">应用程序路径名称</param> /// <param name="arguments">启动参数</param> /// <returns>true表示成功,false表示失败</returns> public static bool StartApp(string appName,string arguments) { bool blnRst = false; Process p = new Process(); p.StartInfo.FileName = appName;//exe,bat and so on p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; p.StartInfo.Arguments = arguments; try { p.Start(); p.WaitForExit(); p.Close(); blnRst = true; } catch { } return blnRst; } /// <summary> /// 启动外部应用程序 /// </summary> /// <param name="appName">应用程序路径名称</param> /// <param name="arguments">启动参数</param> /// <param name="style">进程窗口模式</param> /// <returns>true表示成功,false表示失败</returns> public static bool StartApp(string appName,string arguments,ProcessWindowStyle style) { bool blnRst = false; Process p = new Process(); p.StartInfo.FileName = appName;//exe,bat and so on p.StartInfo.WindowStyle = style; p.StartInfo.Arguments = arguments; try { p.Start(); p.WaitForExit(); p.Close(); blnRst = true; } catch { } return blnRst; } }} webservice是什么东西呢?这都不知道还搞WEB开发? 谢谢 patriot074真的非常感谢你问你一下,你给我的程序,我已经应运了。然后,我该怎么调用它呢? 为甚么下面代码在listview内显示不了数据库内容!各位大仙帮帮忙啊? wpf中如何获取frame中的一个page? 求教,如何实现对IE滚动条的控制 用c#调用外部exe程序,怎么样能不让调用的时候,弹出那个控制台窗口? 100分求助!不够可再加 帮纠正一下一个简单的存储过程 c#中能不能自动加上“}”? 读取文件为什么会使乱码? 可否捕获屏幕? 我想调用其它的软件,给它发快捷键消息,实现一些功能 C#中后台使用split出现的问题 SQL的简单问题
通过vc6打开.c文件:
Process.Start( "work1.c ",C:/Program Files/Microsoft Visual Studio/COMMON/MSDev98/Bin/MSDEV.EXE);
以上这个方法在windows应用程序上已经能够实现了。
现在,我做的是网站系统,想通过网页的形式来调用 vc6程序来打开.c文件
还望高手指点指点.......!
webservice是什么东西呢?
System.Diagnostics.Process.Start("notepad.exe");
你这个是调用算外部程序,所以给你如下代码参考:
/// <summary>
/// 运行外部程序
/// </summary>
/// <param name="exeName">程序路径</param>
/// <returns>0:失败,1:成功</returns>
public bool RunIt( string exeName )
{
//声明一个程序信息类
System.Diagnostics.ProcessStartInfo Info = new System.Diagnostics.ProcessStartInfo();
//设置外部程序名
Info.FileName = exeName;
//声明一个程序类
try
{
System.Diagnostics.Process Proc ;
Proc = System.Diagnostics.Process.Start(Info);
return true;
}
catch
{
return false;
}
}
/// <summary>
/// 判断是否运行
/// </summary>
/// <param name="exeName">程序名</param>
/// <returns>0:没运行,1:运行中</returns>
public bool IsRun( string exeName )
{
string isrunning = "0";
Process[] myProcesses = Process.GetProcesses();
foreach(Process myProcess in myProcesses)
{if ( myProcess.ProcessName == exeName )
{
isrunning = "1";
break;
}
}
if ( isrunning == "1" )
{
return true;
}
else
{
return false;
}
}
/// <summary>
/// 结束进程
/// </summary>
/// <param name="exeName">进程名</param>
/// <returns>0:失败,1:成功</returns>
public bool Kill( string exeName )
{
string isrunning = "0";
Process[] myProcesses = Process.GetProcesses();
foreach(Process myProcess in myProcesses)
{if ( myProcess.ProcessName == exeName )
{
try
{
myProcess.Kill();
isrunning = "1";
}
catch
{
isrunning = "0";
}
break;
}
}
if ( isrunning == "1" )
{
return true;
}
else
{
return false;
}
}///////////////////////////////
using System;
using System.Diagnostics;
namespace ZZ
{
/// <summary>
/// CmdUtility 的摘要说明。
/// </summary>
public class CmdUtility
{
//private Process process; /// <summary>
/// 构造函数
/// </summary>
public CmdUtility()
{
//this.process = new Process();
}
/// <summary>
/// 执行单条命令
/// </summary>
/// <param name="commandText">命令文本</param>
/// <returns>命令输出文本</returns>
public static string ExeCommand(string commandText)
{
Process p = new Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
string strOutput = null;
try
{
p.Start();
p.StandardInput.WriteLine(commandText);
p.StandardInput.WriteLine("exit");
//string formats = s.Replace("\r","").Replace("\n","\r\n");
strOutput = p.StandardOutput.ReadToEnd();
p.WaitForExit();
p.Close();
}
catch(Exception e)
{
strOutput = e.Message;
}
return strOutput;
}
/// <summary>
/// 执行多条命令
/// </summary>
/// <param name="commandArray">命令文本数组</param>
/// <returns>命令输出文本</returns>
public static string ExeCommand(string [] commandTexts)
{
Process p = new Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
string strOutput = null;
try
{
p.Start();
foreach(string item in commandTexts)
{
p.StandardInput.WriteLine(item);
}
p.StandardInput.WriteLine("exit");
strOutput = p.StandardOutput.ReadToEnd();
p.WaitForExit();
p.Close();
}
catch(Exception e)
{
strOutput = e.Message;
}
return strOutput;
}
/// <summary>
/// 启动外部应用程序
/// </summary>
/// <param name="appName">应用程序路径名称</param>
/// <returns>true表示成功,false表示失败</returns>
public static bool StartApp(string appName)
{
bool blnRst = false;
Process p = new Process();
p.StartInfo.FileName = appName;//exe,bat and so on
p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
try
{
p.Start();
p.WaitForExit();
p.Close();
//while (!p.HasExited)
//{
// Thread.Sleep(1000);
//}
blnRst = true;
}
catch
{
}
return blnRst;
}
/// <summary>
/// 启动外部应用程序
/// </summary>
/// <param name="appName">应用程序路径名称</param>
/// <param name="style">进程窗口模式</param>
/// <returns>true表示成功,false表示失败</returns>
public static bool StartApp(string appName,ProcessWindowStyle style)
{
bool blnRst = false;
Process p = new Process();
p.StartInfo.FileName = appName;//exe,bat and so on
p.StartInfo.WindowStyle = style;
try
{
p.Start();
p.WaitForExit();
p.Close();
blnRst = true;
}
catch
{
}
return blnRst;
}
/// <summary>
/// 启动外部应用程序
/// </summary>
/// <param name="appName">应用程序路径名称</param>
/// <param name="arguments">启动参数</param>
/// <returns>true表示成功,false表示失败</returns>
public static bool StartApp(string appName,string arguments)
{
bool blnRst = false;
Process p = new Process();
p.StartInfo.FileName = appName;//exe,bat and so on
p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
p.StartInfo.Arguments = arguments;
try
{
p.Start();
p.WaitForExit();
p.Close();
blnRst = true;
}
catch
{
}
return blnRst;
}
/// <summary>
/// 启动外部应用程序
/// </summary>
/// <param name="appName">应用程序路径名称</param>
/// <param name="arguments">启动参数</param>
/// <param name="style">进程窗口模式</param>
/// <returns>true表示成功,false表示失败</returns>
public static bool StartApp(string appName,string arguments,ProcessWindowStyle style)
{
bool blnRst = false;
Process p = new Process();
p.StartInfo.FileName = appName;//exe,bat and so on
p.StartInfo.WindowStyle = style;
p.StartInfo.Arguments = arguments;
try
{
p.Start();
p.WaitForExit();
p.Close();
blnRst = true;
}
catch
{
}
return blnRst;
}
}
}
这都不知道还搞WEB开发?
然后,我该怎么调用它呢?