1.c#中如何读取一个正在运行程序?
c#中如何读取一个正在运行程序?
你可以用API函数发送指定消息控制Windows Media Player播放、码下停止、码下基因检测指标源码音量大小等操作,码下网页查看更多源码前提是码下随机抽选名称源码必须有一个Windows Media Player在运行
至于如何获得这些消息,看看这里就知道了
/kb/cs/wmp_pinvoke.aspx
using System.Runtime.InteropServices;
[DllImport("User.dll")]
private static extern Int SendMessage(int hWnd,码下程序源码运行截图 int Msg, int wParam, int lParam);
[DllImport("User.dll")]
private static extern int FindWindow(string strClassName,string strWindowName);
private const int WM_COMMAND = 0x;
private const int Stop = 0x;//停止
private const int Paly = 0x;//播放和暂停
private const int VolUp = 0xF;//增大音量
private const int VolDown = 0x;//减小音量
private const int VolMute = 0x;//静音
private void button1_Click(object sender, EventArgs e)
{
int handle = FindWindow(null, "Windows Media Player");//获取正在运行的Windows Media Player的句柄
SendMessage(handle, WM_COMMAND, Paly, 0);//发送指定操作的消息
}