我想从UWP内部控制Windows系统控制。因为那是不可能的,我已经创建了一个服务应用程序作为Windows运行时组件。然后我用Google搜索并发现了这个:
using System;
using System.Windows.Forms; // of course I have no forms
using System.Runtime.InteropServices;
namespace UniversalSandbox
{
public partial class Form1 : Form
{
public const int KEYEVENTF_EXTENTEDKEY = 1;
public const int KEYEVENTF_KEYUP = 0;
public const int VK_MEDIA_NEXT_TRACK = 0xB0;
public const int VK_MEDIA_PLAY_PAUSE = 0xB3;
public const int VK_MEDIA_PREV_TRACK = 0xB1;
[DllImport("user32.dll")]
public static extern void keybd_event(byte virtualKey, byte scanCode,uint flags, IntPtr extraInfo);
但是keybd_even
t:
方法......是外部的,没有属性
有解决方案吗?