如何用C++或C#编写在Windows Vista上启动应用程序的程序?
例如,启动Dreamweaver CS4 ("C:\Program Files\Adobe\Adobe Dreamweaver CS4\Dreamweaver.exe“),并将其放在带有BringWindowToTop-函数的顶部。
发布于 2009-09-24 12:01:19
在c#中
Process.Start("c:\whatever\somefile.exe", <commandline args>);应该这么做
发布于 2009-10-14 07:58:21
using System;
using System.Diagnostics;
namespace Launcher
{
public static class Program
{
public static void Main(string[] args)
{
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = args[0];
startInfo.WindowStyle = ProcessWindowStyle.Normal;
Process.Start(startInfo);
}
}
}发布于 2009-10-18 20:47:11
要启动该程序,请使用:Process.Start。
要查找exe文件的路径,您可以查看注册表。
我建议在注册表中手动搜索您计算机中exe的实际路径,这样可以尝试查看路径保存的位置。
要将窗口带到最前面,您可以使用SetForegroundWindow(int hWnd)和FindWindow(string lpClassName, string lpWindowName),如下所述:
http://www.dotnetspider.com/resources/5772-Bring-e-window-Front-set-It-Active-window.aspx
希望能有所帮助。
https://stackoverflow.com/questions/1471219
复制相似问题