mirror of
https://github.com/jie65535/KeyGo.git
synced 2025-06-02 17:39:13 +08:00
清理代码
This commit is contained in:
parent
077b8b1e13
commit
c7ac1341cc
@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace KeyGo
|
||||
@ -29,7 +24,6 @@ namespace KeyGo
|
||||
/// </value>
|
||||
public bool CloseToHide { get; set; } = true;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Loads the XML.
|
||||
/// </summary>
|
||||
|
@ -151,6 +151,7 @@ namespace KeyGo
|
||||
|
||||
[DllImport("User32.dll")]
|
||||
private static extern bool ShowWindowAsync(IntPtr hWnd, int cmdShow);
|
||||
|
||||
[DllImport("User32.dll")]
|
||||
private static extern bool ShowWindow(IntPtr hWnd, int cmdShow);
|
||||
|
||||
|
@ -5,7 +5,7 @@ using System.Windows.Forms;
|
||||
|
||||
namespace KeyGo
|
||||
{
|
||||
public class AppHotKey
|
||||
public static class AppHotKey
|
||||
{
|
||||
/// <summary>
|
||||
/// 注册热键
|
||||
@ -17,14 +17,7 @@ namespace KeyGo
|
||||
public static void RegKey(IntPtr hwnd, int hotKey_id, KeyModifiers keyModifiers, Keys key)
|
||||
{
|
||||
if (!RegisterHotKey(hwnd, hotKey_id, keyModifiers, key))
|
||||
{
|
||||
throw new Win32Exception();
|
||||
//int code = Marshal.GetLastWin32Error();
|
||||
//if (code == 1409)
|
||||
// MessageBox.Show("热键被占用!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
//else
|
||||
// MessageBox.Show("注册热键失败!错误代码:" + code.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -38,7 +31,6 @@ namespace KeyGo
|
||||
UnregisterHotKey(hwnd, hotKey_id);
|
||||
}
|
||||
|
||||
|
||||
//如果函数执行成功,返回值不为0。
|
||||
//如果函数执行失败,返回值为0。要得到扩展错误信息,调用GetLastError。
|
||||
[DllImport("user32.dll", SetLastError = true)]
|
||||
|
@ -12,6 +12,7 @@ namespace KeyGo
|
||||
}
|
||||
|
||||
public HotKeyItem HotKeyItem { get; set; }
|
||||
|
||||
private void FormHotKey_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (HotKeyItem != null)
|
||||
@ -110,6 +111,5 @@ namespace KeyGo
|
||||
TxtStartupPath.Text = frm.FileName;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -325,6 +325,6 @@ namespace KeyGo
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion 开机自启动
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user