如何实现快速启动

baodayisheng 2008-10-21 11:25:32
现想实现与任务栏中快速启动一样功能,困惑了很久,求解。
C#怎样编写啊
...全文
175 18 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
18 条回复
切换为时间正序
请发表友善的回复…
发表回复
mjjzg 2008-10-21
  • 打赏
  • 举报
回复
这样是调用一个外部进程,像千千静听之类的在system32下没有注册的进程

ProcessStartInfo info = new ProcessStartInfo();
info.FileName = "TTPlayer.exe";
info.WorkingDirectory = @"C:\Program Files\TTPlayer";
Process p=Process.Start(info);
Console.WriteLine("进程ID:{0}\n进程名:
{1}",p.Id,p.ProcessName);


一般情况下像这样就够了省略第三句就够了
记好还要到入using System.Diagnostics;命名空间
wheeler 2008-10-21
  • 打赏
  • 举报
回复
谢谢 潇湘夜雨 的支持 嘎嘎!
qinhl99 2008-10-21
  • 打赏
  • 举报
回复
或者做一个安装程序,来写注册表好了
lovehongyun 2008-10-21
  • 打赏
  • 举报
回复
你想在你的软件中实现调用ie,WORD等功能?

如果是的话就不是什么快速启动的问题.而是怎么去调用外部应用程序的问题

参考Process类.

5楼的代码就对
mjjzg 2008-10-21
  • 打赏
  • 举报
回复
好模糊的问题,
是想做个工具,可通过点击图标,来实现另个程序的运行吗
如是的话————通过定义进程来做
qinhl99 2008-10-21
  • 打赏
  • 举报
回复
http://topic.csdn.net/t/20030709/12/2007525.html
试试这个:
using System;
using System.Runtime.InteropServices;
using IWshRuntimeLibrary;

namespace CreateShortcutCOM {
/// <summary>
/// This class creates a shortcut with COM interoperability
/// </summary>
class ShortcutDemo {
[STAThread]
static void Main(string[] args) {
// Get the app path and filename
string app = Environment.CurrentDirectory + @"\CreateShortcutCOM.exe";

try {
// Create a Windows Script Host Shell class
IWshShell_Class shell = new IWshShell_ClassClass();
// Define the shortcut file
IWshShortcut_Class shortcut = shell.CreateShortcut(app + ".lnk") as IWshShortcut_Class;
// Set all its properties
shortcut.Description = "Smart sample of creating shell shortcut";
shortcut.TargetPath = app;
shortcut.IconLocation = app + ",0";
// Save it
shortcut.Save();
}
catch(COMException ex) {
Console.WriteLine(ex.Message);
}
}
}
}

有封装好的类可以用,看:
http://www.vbaccelerator.com/home/NET/Code/Libraries/Shell_Projects/Creating_and_Modifying_Shortcuts/article.asp
wheeler 2008-10-21
  • 打赏
  • 举报
回复
哦 了解了


Process myProcess = new Process();
myProcess.StartInfo.FileName = "程序名(带完整路径的哦~)";
myProcess.StartInfo.CreateNoWindow = true;
myProcess.Start();

baodayisheng 2008-10-21
  • 打赏
  • 举报
回复
我的意思是把快速起动的功能加入到软件中~~
继续求解
jietuan 2008-10-21
  • 打赏
  • 举报
回复
我不知你要想实现什么,但你可以在打包的时候设置创建桌面快捷方式,在启动目录里面创建快捷方式
baodayisheng 2008-10-21
  • 打赏
  • 举报
回复
快速启动,比如打开IE,显示桌面,打开WORD等等啊
wheeler 2008-10-21
  • 打赏
  • 举报
回复
是要 任务栏图标? 还是要 快速启动?
baodayisheng 2008-10-21
  • 打赏
  • 举报
回复
哦,是这样啊,Thanks
wesleyluo 2008-10-21
  • 打赏
  • 举报
回复
MSDN上使用process的例子:

using System;
using System.Diagnostics;
using System.ComponentModel;

namespace MyProcessSample
{
/// <summary>
/// Shell for the sample.
/// </summary>
class MyProcess
{

/// <summary>
/// Opens the Internet Explorer application.
/// </summary>
void OpenApplication(string myFavoritesPath)
{
// Start Internet Explorer. Defaults to the home page.
Process.Start("IExplore.exe");

// Display the contents of the favorites folder in the browser.
Process.Start(myFavoritesPath);

}

/// <summary>
/// Opens urls and .html documents using Internet Explorer.
/// </summary>
void OpenWithArguments()
{
// url's are not considered documents. They can only be opened
// by passing them as arguments.
Process.Start("IExplore.exe", "www.northwindtraders.com");

// Start a Web page using a browser associated with .html and .asp files.
Process.Start("IExplore.exe", "C:\\myPath\\myFile.htm");
Process.Start("IExplore.exe", "C:\\myPath\\myFile.asp");
}

/// <summary>
/// Uses the ProcessStartInfo class to start new processes, both in a minimized
/// mode.
/// </summary>
void OpenWithStartInfo()
{

ProcessStartInfo startInfo = new ProcessStartInfo("IExplore.exe");
startInfo.WindowStyle = ProcessWindowStyle.Minimized;

Process.Start(startInfo);

startInfo.Arguments = "www.northwindtraders.com";

Process.Start(startInfo);

}

static void Main()
{
// Get the path that stores favorite links.
string myFavoritesPath =
Environment.GetFolderPath(Environment.SpecialFolder.Favorites);

MyProcess myProcess = new MyProcess();

myProcess.OpenApplication(myFavoritesPath);
myProcess.OpenWithArguments();
myProcess.OpenWithStartInfo();

}
}
}
wheeler 2008-10-21
  • 打赏
  • 举报
回复
我的电脑 是C:/windows/system32/ 下面的一个xx.xx 楼主自己查下吧 我也不记得了
baodayisheng 2008-10-21
  • 打赏
  • 举报
回复
应该是文件名吧,不过动行快捷方式是可以的,
那要是启动我的电脑怎办啊
呵呵
baodayisheng 2008-10-21
  • 打赏
  • 举报
回复
好像也不行,不能在软件中创建快捷方式
wheeler 2008-10-21
  • 打赏
  • 举报
回复
myProcess.StartInfo.FileName = @"F:\Documents and Settings\xiaoxiong\桌面\我的电脑";

楼主 你太炫了~~~佩服!佩服!
baodayisheng 2008-10-21
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 asdf311 的回复:]
哦 了解了


C# code
Process myProcess = new Process();
myProcess.StartInfo.FileName = "程序名(带完整路径的哦~)";
myProcess.StartInfo.CreateNoWindow = true;
myProcess.Start();
[/Quote]

比如想打开我的电脑:

Process myProcess = new Process();
myProcess.StartInfo.FileName = @"F:\Documents and Settings\xiaoxiong\桌面\我的电脑";
myProcess.StartInfo.CreateNoWindow = true;
myProcess.Start();

出错

六楼的怎么样

111,088

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧