-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfrmMain.vb
More file actions
562 lines (450 loc) · 22 KB
/
frmMain.vb
File metadata and controls
562 lines (450 loc) · 22 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
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
Imports System.ComponentModel
Imports System.Drawing.Text
Imports System.Runtime.InteropServices
Public Class frmMain
Private MeTiD As UInteger = GetWindowThreadProcessId(Me.Handle, Nothing)
#Region "StartupSequence"
Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles Me.Load
SetMenuTheme(Color.FromArgb(&HFF7AB2F4))
AddHandler SysconfigureToolStripMenuItem.DropDown.MouseLeave, AddressOf cmsTray_MouseLeave
AddHandler SysconfigureToolStripMenuItem.DropDown.Closing, AddressOf cmsTray_Closing
SysconfigureToolStripMenuItem.DropDown.ShowItemToolTips = False
'ApplyScaling()
CursorMagic()
SetCursorVisibility(My.Settings.showcursor)
If My.Settings.xmbclick OrElse My.Settings.scrollActivate OrElse My.Settings.lcCompat Then mH.HookMouse()
' these are off by default to have less false positives on viruscanners
' note: if the mouse is hooked debugging lags the mouse a few seconds when entering break mode
If My.Settings.AutoBoot AndAlso mudproc Is Nothing AndAlso Not (My.Computer.Keyboard.ShiftKeyDown OrElse My.Computer.Keyboard.CtrlKeyDown) Then SysbootToolStripMenuItem.PerformClick()
End Sub
Protected Overloads Overrides ReadOnly Property ShowWithoutActivation() As Boolean
Get
Return True
End Get
End Property
#End Region
#Region "Scaling"
Public Sub ApplyScaling(Optional pt As Point = Nothing)
Dim dpi As UInteger = 96
GetDpiForMonitor(MonitorFromPoint(pt, 2), 0, dpi, dpi)
scaling = CSng(dpi) / 96.0!
Me.BeginInvoke(Sub()
cmsTray.ImageScalingSize = New Size(CInt(16 * scaling), CInt(16 * scaling))
' Force full layout reset
cmsTray.SuspendLayout()
' Reset cached layout
cmsTray.AutoSize = False
cmsTray.Width = 1 ' collapse first
' Update font AFTER scaling
setFont()
' Re-enable autosize so it recalculates
cmsTray.AutoSize = True
cmsTray.ResumeLayout(True)
cmsTray.PerformLayout()
End Sub)
End Sub
#End Region
#Region "Cursor Magic"
Private Sub tmrTick_Tick(sender As Object, e As EventArgs) Handles tmrTick.Tick 'interval 1337 ms
If mudproc IsNot Nothing AndAlso mudproc.HasExited Then
SysbootToolStripMenuItem.Enabled = True
GuiVfxBendToolStripMenuItem.Enabled = False
End If
CursorMagic()
'Debug.Print($"{mudproc?.MainWindowTitle}:{mudproc?.Id}:{hackMudHandle}")
End Sub
Private Sub CursorMagic()
Dim pp As Process = Process.GetProcessesByName("hackmud_win").FirstOrDefault
If pp IsNot Nothing AndAlso String.IsNullOrWhiteSpace(pp.MainWindowTitle) Then pp = Nothing
mudproc = pp
hackMudHandle = If(mudproc?.MainWindowHandle, IntPtr.Zero)
If hackMudHandle <> IntPtr.Zero Then
AttachThreadInput(GetWindowThreadProcessId(hackMudHandle, Nothing), MeTiD, True)
End If
End Sub
Private ShowValue As Integer
Public Sub SetCursorVisibility(visible As Boolean)
' ensure the cursor is visible if the handle is not valid
If hackMudHandle = IntPtr.Zero Then visible = True
' set visibility and get the current state of the cursor
ShowValue = ShowCursor(visible)
Debug.Print($"visible:{visible} ShowValue:{ShowValue}")
'this is a mess
If visible Then
' ensure exact value
Do While ShowValue <= 0
ShowValue = ShowCursor(True)
Debug.Print($"ensuring cursor visibility: {ShowValue}")
Loop
Do While ShowValue > 2
ShowValue = ShowCursor(False)
Debug.Print($"ensuring exact value: {ShowValue}")
Loop
Else
' ensure exact value
Do While ShowValue > If(My.Settings.showcursor, 1, -1)
ShowValue = ShowCursor(False)
Debug.Print($"ensuring cursor invisibility: {ShowValue}")
Loop
Do While ShowValue < -1
ShowValue = ShowCursor(True)
Debug.Print($"ensuring exact value: {ShowValue}")
Loop
End If
End Sub
#End Region
#Region "Hide from alt tab and Taskbar"
Protected Overrides ReadOnly Property CreateParams As CreateParams
Get
Dim cp As CreateParams = MyBase.CreateParams
cp.ExStyle = cp.ExStyle Or WindowStylesEx.WS_EX_TOOLWINDOW
Return cp
End Get
End Property
#End Region
#Region "Menu Theming"
Private Sub SetMenuTheme(col As Color)
cmsTray.Renderer = New ThemedRenderer(col)
SetThemeRecurse(cmsTray.Items, col)
End Sub
Private Sub SetThemeRecurse(collection As ToolStripItemCollection, col As Color)
For Each item As ToolStripMenuItem In collection.OfType(Of ToolStripMenuItem) ' skip separators
item.ForeColor = col
AddHandler item.MouseEnter, Sub(s As ToolStripMenuItem, e As EventArgs) s.ForeColor = Color.White
AddHandler item.MouseLeave, Sub(s As ToolStripMenuItem, e As EventArgs) s.ForeColor = col
If item.HasDropDown Then SetThemeRecurse(item.DropDownItems, col)
Next
End Sub
#End Region
#Region "setFont"
Private pfc As PrivateFontCollection
Private Sub setFont()
Try
If pfc Is Nothing Then
pfc = New PrivateFontCollection
Dim data As IntPtr = Marshal.AllocCoTaskMem(My.Resources.whitrabt.Length)
Marshal.Copy(My.Resources.whitrabt, 0, data, My.Resources.whitrabt.Length)
AddFontMemResourceEx(data, My.Resources.whitrabt.Length, FR_PRIVATE, Nothing)
pfc.AddMemoryFont(data, My.Resources.whitrabt.Length)
Marshal.FreeCoTaskMem(data)
End If
'todo: set fontsize according to mainscreen scaling
cmsTray.Font = New Font(pfc.Families(0), 12 * scaling, GraphicsUnit.Pixel)
Catch ex As Exception
Debug.Print($"bab0 setting font {ex.Message}")
End Try
End Sub
#End Region
#Region "trayIcon and Contextmenu"
Private Sub ExitToolStripMenuItem_Click(sender As ToolStripMenuItem, e As EventArgs) Handles ExitToolStripMenuItem.Click
mH.UnhookMouse()
Me.Close()
End Sub
Private Sub trayIcon_MouseDown(sender As Object, e As MouseEventArgs) Handles trayIcon.MouseUp
If e.Button = MouseButtons.Right Then
ApplyScaling(Cursor.Position)
cmsTray.Tag = ToolStripDropDownDirection.AboveLeft
cmsTray.Show(Me, Me.PointToClient(Cursor.Position), ToolStripDropDownDirection.AboveLeft)
End If
End Sub
Private Sub cmsTray_Opening(sender As ContextMenuStrip, e As CancelEventArgs) Handles cmsTray.Opening
sender.Opacity = 0
'this is needed to make DPI change message fire
'SetWindowPos(Me.Handle, SWP_HWND.TOPMOST, -1, -1, -1, -1, SetWindowPosFlags.IgnoreResize Or SetWindowPosFlags.IgnoreMove Or SetWindowPosFlags.DoNotActivate)
SysbootToolStripMenuItem.Enabled = mudproc Is Nothing
SetCursorVisibility(True)
' this is for when OOG crackers send esc followed by WM_ACTIVATE, SetForegroundWindow() or AppActivate()
SendMessage(hackMudHandle, WM_ACTIVATE, 1, 0) 'prevents the menu from closing when the above happens
' Note: you need to unminimize hackmud before sending esc or it will fail
' in your OOG WM_ACTIVATE is preferred as it doesn't make hackmud pop to front nor steal focus
' note: some applications still don't play nice with this so reults may vary.
If IsIconic(hackMudHandle) Then SendMessage(hackMudHandle, WM_SYSCOMMAND, SC_RESTORE, 0)
If hackMudHandle = IntPtr.Zero Then SetForegroundWindow(Me.Handle) 'fixes menu appearing in taskbar when called from 2nd instance
If mH.HookHandle = IntPtr.Zero Then mH.HookMouse() ' additional logic in mousehook to close menu when appropriate
'animation prep
If animForm.IsDisposed Then
animForm = New InactiveForm With {
.FormBorderStyle = FormBorderStyle.None,
.StartPosition = FormStartPosition.Manual,
.TopMost = False,
.ShowInTaskbar = False,
.BackColor = Color.Black,
.TransparencyKey = .BackColor,
.Opacity = 1
}
End If
If Not animForm.Visible Then
animForm.Show()
End If
End Sub
Private Sub cmsTray_Opened(sender As ContextMenuStrip, e As EventArgs) Handles cmsTray.Opened
Dim hwnd As IntPtr = sender.Handle
Application.DoEvents() 'needed to have getClientRect report actual value after scaling
Dim rcM As RECT
GetClientRect(hwnd, rcM)
Dim loc As Point
Dim wa As Rectangle
Select Case sender.Tag
Case ToolStripDropDownDirection.AboveLeft
loc = Control.MousePosition - New Point(rcM.right, rcM.bottom)
Case Else
loc = Control.MousePosition
End Select
wa = Screen.FromPoint(Control.MousePosition).WorkingArea
loc = New Point(Math.Max(wa.X, loc.X), Math.Max(wa.Y, loc.Y))
If loc.Y + rcM.bottom > wa.Bottom Then loc.Y = wa.Bottom - rcM.bottom
If loc.X + rcM.right > wa.Right Then loc.X = wa.Right - rcM.right
SetWindowPos(hwnd, SWP_HWND.TOP, loc.X, loc.Y, -1, -1, SetWindowPosFlags.IgnoreResize Or SetWindowPosFlags.DoNotActivate)
AnimateMenu(sender, sender.Tag, 80)
sender.Opacity = 1
End Sub
Public LastClickedItem As ToolStripItem
Private Sub CmsTray_ItemClicked(sender As Object, e As ToolStripItemClickedEventArgs) Handles cmsTray.ItemClicked, SysconfigureToolStripMenuItem.DropDownItemClicked
LastClickedItem = e.ClickedItem
End Sub
Private Sub cmsTray_Closing(sender As Object, e As ToolStripDropDownClosingEventArgs) Handles cmsTray.Closing
If TypeOf LastClickedItem Is ToolStripSeparator OrElse SysconfigureToolStripMenuItem.DropDownItems.Contains(LastClickedItem) Then
e.Cancel = True
Debug.Print($"Prevented closing due to {If(TypeOf LastClickedItem Is ToolStripSeparator, "seperator", "configItem")} click")
LastClickedItem = Nothing
End If
End Sub
Private Sub cmsTray_Closed(sender As ContextMenuStrip, e As ToolStripDropDownClosedEventArgs) Handles cmsTray.Closed
Debug.Print($"systray closed {e.CloseReason}")
SetCursorVisibility(My.Settings.showcursor)
MenuTooltip.Hide()
End Sub
Private Sub cmsTray_MouseLeave(sender As Object, e As EventArgs) Handles cmsTray.MouseLeave ',sysconfig.dropdown.mouseleave
MenuTooltip.Hide()
End Sub
Private Sub SysconfigureToolStripMenuItem_DropDownOpening(sender As ToolStripMenuItem, e As EventArgs) Handles SysconfigureToolStripMenuItem.DropDownOpening
AutoBootToolStripMenuItem.Checked = My.Settings.AutoBoot
'-
CursorshowToolStripMenuItem.Checked = My.Settings.showcursor
vncCompatToolStripMenuItem.Checked = My.Settings.lcCompat
XmbclickToolStripMenuItem.Checked = My.Settings.xmbclick
WheelScrollActivateToolStripMenuItem.Checked = My.Settings.scrollActivate
'-
GuiVfxBendToolStripMenuItem.Enabled = mudproc IsNot Nothing
'scaling fix 'is this still needed now that we are dpi aware?
'SetWindowPos(Me.Handle, SWP_HWND.TOPMOST, -1, -1, -1, -1, SetWindowPosFlags.IgnoreResize Or SetWindowPosFlags.IgnoreMove Or SetWindowPosFlags.DoNotActivate)
End Sub
Private Sub SysconfigureItemToolStripMenuItem_Click(sender As ToolStripMenuItem, e As EventArgs) Handles AutoBootToolStripMenuItem.Click, CursorshowToolStripMenuItem.Click,
vncCompatToolStripMenuItem.Click, XmbclickToolStripMenuItem.Click, WheelScrollActivateToolStripMenuItem.Click
'toggle checkmark
sender.Checked = Not sender.Checked
'set settings
Select Case sender.Name
Case AutoBootToolStripMenuItem.Name
My.Settings.AutoBoot = sender.Checked
Case CursorshowToolStripMenuItem.Name
My.Settings.showcursor = sender.Checked
Case vncCompatToolStripMenuItem.Name
My.Settings.lcCompat = sender.Checked
Case XmbclickToolStripMenuItem.Name
My.Settings.xmbclick = sender.Checked
Case WheelScrollActivateToolStripMenuItem.Name
My.Settings.scrollActivate = sender.Checked
End Select
'hook mouse if applicable
If mH.HookHandle = IntPtr.Zero AndAlso (My.Settings.lcCompat OrElse My.Settings.xmbclick OrElse My.Settings.scrollActivate) Then mH.HookMouse()
'counter-intuitively the click event fires after the closed event
Debug.Print("SysconfigureItem_Click")
My.Settings.Save()
End Sub
Private Sub SysbootToolStripMenuItem_Click(sender As ToolStripMenuItem, e As EventArgs) Handles SysbootToolStripMenuItem.Click
Dim pp As Process = Nothing
Try
pp = Process.Start("explorer", "steam://rungameid/469920")
Catch ex As Exception
Debug.Print($"bab0 starting hackmud {ex.Message}")
Finally
pp?.Dispose()
End Try
End Sub
Private Sub TrayIcon_DoubleClick(sender As NotifyIcon, e As MouseEventArgs) Handles trayIcon.MouseDoubleClick
If e.Button <> MouseButtons.Left Then Exit Sub
If IsIconic(hackMudHandle) Then SendMessage(hackMudHandle, WM_SYSCOMMAND, SC_RESTORE, 0)
SetForegroundWindow(hackMudHandle)
End Sub
Private Sub setGuiVfxBendToolStripMenuItem_Click(sender As ToolStripMenuItem, e As EventArgs) Handles GuiVfxBendToolStripMenuItem.Click
'todo: find a cleaner way to select shell input
Dim curPos As Point = Cursor.Position
Dim pt As New Point(100, 100) 'need to account for invis border and gui.size which alters it's size
ClientToScreen(hackMudHandle, pt)
Cursor.Position = pt
SendMessage(hackMudHandle, WM_LBUTTONDOWN, 0, 0)
Threading.Thread.Sleep(1) 'this is needed or we might get a dragbox on slower hardware
SendMessage(hackMudHandle, WM_LBUTTONUP, 0, 0)
Cursor.Position = curPos
'send esc to clear input
SendMessage(hackMudHandle, WM_KEYDOWN, Keys.Escape, 1) ' esc down
SendMessage(hackMudHandle, WM_KEYUP, Keys.Escape, 1 << 31) ' esc up
SendMessage(hackMudHandle, WM_ACTIVATE, WA_ACTIVE, 0) ' needed for esc to take, note: hm should aready be active so this isn't necessary but left in just in case
'send text
Dim text = "gui.vfx{bend:0}"
For i = 0 To text.Count() - 1
PostMessage(hackMudHandle, WM_CHAR, Asc(text.Chars(i)), 0)
Next
'send enter
SendMessage(hackMudHandle, WM_CHAR, Keys.Return, 0)
End Sub
Public Sub AnimateMenu(menu As ToolStripDropDown, direction As ToolStripDropDownDirection, animationDurationMs As Integer)
Dim thumb As IntPtr = IntPtr.Zero
animForm.Bounds = menu.Bounds
If animationDurationMs = 0 Then
menu.Opacity = 1
Exit Sub
End If
' --- start stopwatch first ---
Dim sw As Stopwatch = Stopwatch.StartNew()
Dim progress As Double = 0
Dim finalRect As RECT
GetClientRect(menu.Handle, finalRect)
' Register DWM thumbnail
Dim hwnd As IntPtr = menu.Handle
If DwmRegisterThumbnail(animForm.Handle, hwnd, thumb) <> 0 Then
Debug.Print("DwmRegisterThumbnail failed")
Return
End If
Dim finalWidth As Integer = finalRect.right - finalRect.left
Dim finalHeight As Integer = finalRect.bottom - finalRect.top
Dim aspectRatio As Double = finalWidth / finalHeight
' Compute start rectangle
Dim startRect As RECT
Select Case direction
Case ToolStripDropDownDirection.AboveLeft
startRect = New RECT With {
.left = finalRect.right - 32,
.top = finalRect.bottom - 32 / aspectRatio,
.right = finalRect.right,
.bottom = finalRect.bottom
}
Case ToolStripDropDownDirection.AboveRight
startRect = New RECT With {
.left = finalRect.left,
.top = finalRect.bottom - 32 / aspectRatio,
.right = finalRect.left + 32,
.bottom = finalRect.bottom
}
Case Else
startRect = New RECT With {
.left = finalRect.left,
.top = finalRect.top,
.right = finalRect.left + 32,
.bottom = finalRect.top - 32 / aspectRatio
}
End Select
Debug.Print($"{direction} {finalRect} {startRect}")
' Initial DWM thumbnail properties
Dim props As New DWM_THUMBNAIL_PROPERTIES With {
.dwFlags = DwmThumbnailFlags.DWM_TNP_RECTDESTINATION Or
DwmThumbnailFlags.DWM_TNP_OPACITY Or
DwmThumbnailFlags.DWM_TNP_SOURCECLIENTAREAONLY Or
DwmThumbnailFlags.DWM_TNP_VISIBLE,
.rcDestination = startRect,
.Opacity = 0,
.fVisible = True,
.fSourceClientAreaOnly = True
}
' --- animate ---
While progress < 1.0
progress = Math.Min(1.0, sw.Elapsed.TotalMilliseconds / animationDurationMs)
' interpolate rectangle and opacity
props.rcDestination.left = CInt(startRect.left + (finalRect.left - startRect.left) * progress)
props.rcDestination.top = CInt(startRect.top + (finalRect.top - startRect.top) * progress)
props.rcDestination.right = CInt(startRect.right + (finalRect.right - startRect.right) * progress)
props.rcDestination.bottom = CInt(startRect.bottom + (finalRect.bottom - startRect.bottom) * progress)
props.opacity = CByte(Math.Min(255, 255 * progress))
DwmUpdateThumbnailProperties(thumb, props)
DwmFlush()
End While
menu.Opacity = 1
DwmUnregisterThumbnail(thumb)
End Sub
Public animForm As New InactiveForm() With {
.FormBorderStyle = FormBorderStyle.None,
.StartPosition = FormStartPosition.Manual,
.TopMost = True,
.ShowInTaskbar = False,
.BackColor = Color.Black,
.TransparencyKey = .BackColor,
.Opacity = 1
}
Public Class InactiveForm : Inherits Form
Protected Overrides ReadOnly Property ShowWithoutActivation As Boolean
Get
Return True
End Get
End Property
Protected Overrides ReadOnly Property CreateParams As CreateParams
Get
Dim cp As CreateParams = MyBase.CreateParams
' Const CS_DROPSHADOW As Integer = &H20000
'cp.Style = WindowStyles.WS_POPUP Or WindowStyles.WS_VISIBLE
cp.ExStyle = cp.ExStyle Or WindowStylesEx.WS_EX_TOOLWINDOW
'cp.ClassStyle = cp.ClassStyle Or CS_DROPSHADOW
Return cp
End Get
End Property
End Class
#End Region
#Region "WndProc"
Dim DisplayChangeBusy As Boolean = False
Protected Overrides Sub WndProc(ByRef m As Message)
MyBase.WndProc(m)
If m.Msg = WM_DISPLAYCHANGE Then
Debug.Print("WM_DISPLAYCHANGE")
If Not DisplayChangeBusy Then
DisplayChangeBusy = True
Task.Run(Sub()
ApplyScaling()
'nudge blurry trayicon so it is sharp again, no longer needed in W11?
Threading.Thread.Sleep(4000)
trayIcon.Visible = False
trayIcon.Visible = True
DisplayChangeBusy = False
End Sub)
End If
End If
End Sub
#End Region
#If DEBUG Then
#Region "SendEsc Example Code"
Private Async Function SendEsc() As Task
'Todo: find a way to send esc with hackmud minimized 'maybe a client bug?
If IsIconic(hackMudHandle) Then
'make sure window doesn't pop to front when doing showwindow
SetWindowPos(hackMudHandle, SWP_HWND.BOTTOM, -1, -1, -1, -1,
SetWindowPosFlags.IgnoreMove Or
SetWindowPosFlags.IgnoreResize Or
SetWindowPosFlags.DoNotActivate)
'restore the window w/o activating it
ShowWindow(hackMudHandle, SW_SHOWNOACTIVATE)
End If
Await Task.Delay(33) 'there is a timing issue when following a PostMessage WM_CHAR
SendMessage(hackMudHandle, WM_KEYDOWN, Keys.Escape, 1) ' esc down
SendMessage(hackMudHandle, WM_KEYUP, Keys.Escape, 1 << 31) ' esc up
SendMessage(hackMudHandle, WM_ACTIVATE, WA_ACTIVE, 0) ' needed for esc to take. note: contrairy to other methods this doesn't bring hackmud to front
End Function
#Region "NativeMethods"
Public Const SW_HIDE = 0
Public Const SW_SHOWNORMAL = 1
Public Const SW_NORMAL = 1
Public Const SW_SHOWMINIMIZED = 2
Public Const SW_SHOWMAXIMIZED = 3
Public Const SW_MAXIMIZE = 3
Public Const SW_SHOWNOACTIVATE = 4
Public Const SW_SHOW = 5
Public Const SW_MINIMIZE = 6
Public Const SW_SHOWMINNOACTIVE = 7
Public Const SW_SHOWNA = 8
Public Const SW_RESTORE = 9
Public Const SW_SHOWDEFAULT = 10
Public Const SW_FORCEMINIMIZE = 11
<Runtime.InteropServices.DllImport("user32.dll")>
Private Shared Function ShowWindow(Hwnd As IntPtr, iCmdShow As Integer) As Integer : End Function
#End Region
#End Region
#End If
End Class