/
App.Native.vb
154 lines (121 loc) · 6.71 KB
/
App.Native.vb
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
Imports System.Runtime.InteropServices
Namespace App
Public Class Native
#Region "Dll Imports"
<DllImport("user32.dll", EntryPoint:="GetWindowThreadProcessId", SetLastError:=True, CharSet:=CharSet.Unicode, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function GetWindowThreadProcessId(ByVal hWnd As Long, ByVal lpdwProcessId As Long) As Long
End Function
<DllImport("user32.dll", SetLastError:=True)> _
Public Shared Function FindWindow(ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr
End Function
<DllImport("user32.dll", SetLastError:=True)> _
Public Shared Function SetParent(ByVal hWndChild As IntPtr, ByVal hWndNewParent As IntPtr) As Long
End Function
<DllImport("user32.dll", EntryPoint:="GetWindowLongA", SetLastError:=True)> _
Public Shared Function GetWindowLong(ByVal hWnd As IntPtr, ByVal nIndex As Integer) As Long
End Function
<DllImport("user32.dll")> _
Public Shared Function SetWindowLong(ByVal hWnd As IntPtr, ByVal nIndex As Integer, ByVal dwNewLong As Long) As Integer
End Function
<DllImport("user32.dll", SetLastError:=True)> _
Public Shared Function SetWindowPos(ByVal hWnd As IntPtr, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
End Function
<DllImport("user32.dll", SetLastError:=True)> _
Public Shared Function MoveWindow(ByVal hWnd As IntPtr, ByVal x As Integer, ByVal y As Integer, ByVal cx As Integer, ByVal cy As Integer, ByVal repaint As Boolean) As Boolean
End Function
<DllImport("user32.dll", EntryPoint:="PostMessageA", SetLastError:=True)> _
Public Shared Function PostMessage(ByVal hWnd As IntPtr, ByVal Msg As UInteger, ByVal wParam As Integer, ByVal lParam As Integer) As Boolean
End Function
<DllImport("user32")> _
Public Shared Function ShowWindow(ByVal hWnd As IntPtr, ByVal nCmdShow As Integer) As Integer
End Function
<DllImport("user32.dll")> _
Public Shared Function BringWindowToTop(ByVal hWnd As IntPtr) As Boolean
End Function
<DllImport("user32.dll")> _
Public Shared Function SetForegroundWindow(ByVal hWnd As IntPtr) As Boolean
End Function
<DllImport("user32.dll")> _
Public Shared Function GetForegroundWindow() As IntPtr
End Function
<DllImport("user32.dll", EntryPoint:="GetWindowTextLengthA")> _
Public Shared Function GetWindowTextLength(ByVal hWnd As IntPtr) As Long
End Function
<DllImport("user32.dll")> _
Public Shared Function IsIconic(ByVal hWnd As IntPtr) As Integer
End Function
<DllImport("user32.dll")> _
Public Shared Function GetSystemMenu(ByVal hWnd As IntPtr, ByVal bRevert As Boolean) As IntPtr
End Function
<DllImport("user32.dll")> _
Public Shared Function AppendMenu(ByVal hMenu As IntPtr, ByVal uFlags As Int32, ByVal uIDNewItem As IntPtr, ByVal lpNewItem As String) As Boolean
End Function
<DllImport("user32")> _
Public Shared Function InsertMenu(ByVal hMenu As IntPtr, ByVal uPosition As Integer, ByVal uFlags As Integer, ByVal uIDNewItem As IntPtr, ByVal lpNewItem As String) As Boolean
End Function
<DllImport("user32")> _
Public Shared Function SetMenuItemBitmaps(ByVal hMenu As IntPtr, ByVal uPosition As Integer, ByVal uFlags As Integer, ByVal hBitmapUnchecked As IntPtr, ByVal hBitmapChecked As IntPtr) As Boolean
End Function
<DllImport("user32")> _
Public Shared Function CreatePopupMenu() As IntPtr
End Function
<DllImport("user32")> _
Public Shared Function SendMessage(ByVal hWnd As IntPtr, ByVal msg As Integer, ByVal wparam As Integer, ByVal lparam As Integer) As Integer
End Function
<DllImport("user32")> _
Public Shared Function MapVirtualKey(ByVal wCode As Integer, ByVal wMapType As Integer) As Integer
End Function
<DllImport("user32")> _
Public Shared Function PostMessage(ByVal hWnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Long
End Function
<DllImport("user32")> _
Public Shared Function RegisterHotKey(ByVal Handle As IntPtr, ByVal ID As Integer, ByVal Modifier As Integer, ByVal Key As Integer) As Integer
End Function
<DllImport("user32")> _
Public Shared Function UnregisterHotKey(ByVal Handle As IntPtr, ByVal ID As Integer) As Integer
End Function
<DllImport("kernel32")> _
Public Shared Function GlobalAddAtom(ByVal lpString As String) As Integer
End Function
<DllImport("kernel32")> _
Public Shared Function GlobalDeleteAtom(ByVal nAtom As Integer) As Integer
End Function
#End Region
#Region "Constants"
Public Const SWP_NOOWNERZORDER As Integer = 512
Public Const SWP_NOREDRAW As Integer = 8
Public Const SWP_NOZORDER As Integer = 4
Public Const SWP_SHOWWINDOW As Integer = 64
Public Const WS_EX_MDICHILD As Integer = 64
Public Const SWP_FRAMECHANGED As Integer = 32
Public Const SWP_NOACTIVATE As Integer = 16
Public Const SWP_ASYNCWINDOWPOS As Integer = 16384
Public Const SWP_NOMOVE As Integer = 2
Public Const SWP_NOSIZE As Integer = 1
Public Const GWL_STYLE As Integer = (-16)
Public Const WS_VISIBLE As Integer = 268435456
Public Const WM_CLOSE As Integer = 16
Public Const WS_CHILD As Integer = 1073741824
Public Const WS_MAXIMIZE As Integer = 16777216
Public Const SW_SHOWMAXIMIZED As Integer = 3
Public Const SW_RESTORE As Integer = 9
Public Const MF_STRING As Integer = &H0
Public Const MF_SEPARATOR As Integer = &H800&
Public Const MF_BYCOMMAND As Integer = &H0
Public Const MF_BYPOSITION As Integer = &H400
Public Const MF_POPUP As Integer = &H10
Public Const WM_GETTEXT As Integer = &HD
Public Const WM_ACTIVATEAPP As Integer = &H1C
Public Const WM_WINDOWPOSCHANGED As Integer = &H47
Public Const WM_SYSCOMMAND As Integer = &H112
Public Const WM_LBUTTONDOWN As Integer = &H201
Public Const WM_LBUTTONUP As Integer = &H202
Public Const WM_RBUTTONDOWN As Integer = &H204
Public Const WM_RBUTTONUP As Integer = &H205
Public Const WM_KEYDOWN As Integer = &H100
Public Const WM_KEYUP As Integer = &H101
Public Const VK_CONTROL As Integer = &H11
Public Const VK_C As Integer = &H67
#End Region
End Class
End Namespace