-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathw32api.cs
More file actions
47 lines (38 loc) · 1.33 KB
/
w32api.cs
File metadata and controls
47 lines (38 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace hideForm
{
class W32api
{
public delegate bool WNDENUMPROC(IntPtr HWind, int lParam);
[DllImport("user32.dll")]
public extern static int GetWindowTextW(IntPtr HWnd, [MarshalAs(UnmanagedType.LPWStr)]StringBuilder lpString, int nMaxCount);
[DllImport("user32.dll")]
public extern static bool EnumWindows(WNDENUMPROC lpEnumFunc, int lParam);
[DllImport("user32.dll")]
public extern static bool ShowWindow(IntPtr hWnd, int nCmdShow);
[DllImport("user32.dll")]
public extern static bool RegisterHotKey(IntPtr hWnd, int id, uint fsModifiers, System.Windows.Forms.Keys vkey);
[DllImport("user32.dll")]
public extern static bool UnregisterHotKey(IntPtr hWnd, int id);
[DllImport("user32.dll")]
public extern static IntPtr GetForegroundWindow();
}
//保存当前设置的快捷键信息
public struct KeySetting
{
public uint sfsModifiers;
public String svkey;
public uint hfsModifiers;
public String hvkey;
}
//保存窗口句柄和窗口名称的结构体
public struct HwndInfo
{
public IntPtr HWnd;
public String HWndName;
}
}