1.c#中如何读取一个正在运行程序?
c#中如何读取一个正在运行程序?
你可以用API函数发送指定消息控制Windows Media Player播放、码下停止、码下socketchannel 源码音量大小等操作,码下同花顺分时预警源码前提是码下erlang c源码分析必须有一个Windows Media Player在运行
至于如何获得这些消息,看看这里就知道了
/kb/cs/wmp_pinvoke.aspx
using System.Runtime.InteropServices;
[DllImport("User.dll")]
private static extern Int SendMessage(int hWnd,码下安卓 im 源码 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);//发送指定操作的消息
}
2024-11-15 06:16
2024-11-15 05:36
2024-11-15 05:04
2024-11-15 05:00
2024-11-15 04:52
2024-11-15 04:43
2024-11-15 04:19
2024-11-15 04:16