我想在windows shell中注册我的桌面应用程序快捷方式。如果我的桌面应用程序处于最小化模式,那么我想运行快捷键,即我在我创建的桌面应用程序中设置。 我的主要动机是当我的应用程序处于最小化模式时,我想运行快捷键来获取活动屏幕的屏幕截图。 我已经尝试了以下代码来最小化我的桌面应用程序。
public TemplatesCreation()
{
InitializeComponent();
trayMenu = new ContextMenu();
trayMenu.MenuItems.Add("Exit", OnExit);
trayIcon = new NotifyIcon();
trayIcon.Text = "MyTrayApp";
trayIcon.Icon = new Icon(SystemIcons.Application, 40, 40);
trayIcon.ContextMenu = trayMenu;
trayIcon.Visible = true;
protected override void OnLoad(EventArgs e)
{
Visible = true; // Hide form window.
ShowInTaskbar = false; // Remove from taskbar.
base.OnLoad(e);
}
private void OnExit(object sender, EventArgs e)
{
Application.Exit();
}
提前致谢