📄 processexecute.cs
字号:
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Threading;
namespace iPhoneUI
{
class ProcessExecute
{
const int VK_TTALK = 114;
const int KEYEVENTF_KEYDOWN = 0x0;
const int KEYEVENTF_KEYUP = 0x2;
[DllImport("coredll.dll", EntryPoint = "keybd_event", SetLastError = true)]
internal static extern void keybd_event(byte bVk, byte bScan, int dwFlags, int dwExtraInfo);
private static void StartProcess_old(string FileName)
{
try
{
System.Diagnostics.Process myProcess = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo();
psi.FileName = FileName;
psi.UseShellExecute = true;
myProcess.StartInfo = psi;
myProcess.Start();
// myProcess.WaitForExit();
}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
}
}
private static void StartLink(string FileName)
{
try
{
System.Diagnostics.Process myProcess = new System.Diagnostics.Process();
myProcess.StartInfo.FileName = FileName;
myProcess.Start();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
private static void StartProcess(string FileName)
{
try
{
if (!System.IO.File.Exists(FileName))
return;
System.Diagnostics.Process myProcess = new System.Diagnostics.Process();
myProcess.StartInfo.UseShellExecute = true;
myProcess.StartInfo.FileName = FileName;
myProcess.Start();
// myProcess.WaitForExit();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
public static void Phone()
{
//keybd_event(VK_TTALK, 0, KEYEVENTF_KEYDOWN, 0);
StartProcess(@"\windows\cprog.exe");
}
public static void MediaPlayer()
{
StartProcess(@"\windows\WMPlayer.exe");
}
public static void InternetExplorer()
{
StartProcess(@"\windows\iExplore.exe");
}
public static void Calc()
{
StartProcess(@"\windows\MobileCalculator.exe");
}
public static void Notes()
{
StartProcess(@"\windows\Notes.exe");
}
public static void Picture()
{
StartLink(@"\Windows\Start Menu\Programs\Pictures & Videos.lnk");
}
private static void StartProcess(string FileName, string sPath)
{
try
{
if (!System.IO.File.Exists(FileName))
return;
System.Diagnostics.Process myProcess = new System.Diagnostics.Process();
myProcess.StartInfo.UseShellExecute = true;
myProcess.StartInfo.FileName = FileName;
myProcess.StartInfo.Arguments = sPath;
myProcess.Start();
myProcess.WaitForExit();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
public static void Camera()
{
StartLink(@"\Windows\Camera.Ink");
}
internal static void Calendar()
{
StartProcess(@"\Windows\Calendar.exe");
}
internal static void Settings()
{
StartProcess(@"\Windows\Calendar.exe");
}
internal static void Mail()
{
StartProcess(@"\Windows\tMail.exe");
// StartRaw(@"\Windows\Start Menu\Messaging.lnk");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -