-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNativeMethods.vb
108 lines (87 loc) · 4.02 KB
/
NativeMethods.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
' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Imports System.Runtime.InteropServices
Namespace Microsoft.VisualBasic.CompilerServices
<ComVisible(False)>
Friend Module NativeMethods
<DllImport("user32.dll")>
Public Function LockWindowUpdate(hWndLock As IntPtr) As Boolean
End Function
#Region "Scroll Bar Support"
Public Enum SBOrientation As Integer
HORZ = &H0
VERT = &H1
CTL = &H2
BOTH = &H3
End Enum
<Flags>
Public Enum ScrollInfoMasks As Integer
RANGE = &H1
PAGE = &H2
POS = &H4
DISABLENOSCROLL = &H8
TRACKPOS = &H10
ALL = RANGE Or PAGE Or POS Or TRACKPOS
End Enum
<DllImport("user32.dll", EntryPoint:=NameOf(GetScrollBarInfo))>
Friend Function GetScrollBarInfo(hwnd As IntPtr,
idObject As Integer,
ByRef psbi As SCROLLBARINFO
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function
<DllImport("user32.dll", SetLastError:=True)>
Friend Function GetScrollInfo(
hWnd As IntPtr,
<MarshalAs(UnmanagedType.I4)> fnBar As SBOrientation,
ByRef lpsi As SCROLLINFO
) As Integer
End Function
<DllImport("user32.dll", SetLastError:=True, ThrowOnUnmappableChar:=True, CharSet:=CharSet.Auto)>
Friend Function SetScrollInfo(
hWnd As IntPtr,
<MarshalAs(UnmanagedType.I4)> nBar As SBOrientation,
<MarshalAs(UnmanagedType.Struct)> ByRef lpsi As SCROLLINFO,
<MarshalAs(UnmanagedType.Bool)> bRepaint As Boolean
) As Integer
End Function
'This function queries or sets system-wide parameters, and updates the user profile during the process.
<DllImport("user32", EntryPoint:=NameOf(SystemParametersInfo), CharSet:=CharSet.Unicode, SetLastError:=True)>
Public Function SystemParametersInfo(intAction As Integer,
intParam As Integer,
strParam As String,
intWinIniFlag As Integer
) As Integer
' returns non-zero value if function succeeds
End Function
<StructLayout(LayoutKind.Sequential)>
Friend Structure RECT
Public Left, Top, Right, Bottom As Integer
Public Function ToRectangle() As Rectangle
Return New Rectangle(Left, Top, Right - Left, Bottom - Top)
End Function
End Structure
<Serializable, StructLayout(LayoutKind.Sequential)>
Friend Structure SCROLLINFO
Public CB_Size As UInteger
<MarshalAs(UnmanagedType.U4)> Public F_Mask As ScrollInfoMasks
Public N_Min As Integer
Public N_Max As Integer
Public N_Page As UInteger
Public N_Pos As Integer
Public N_TrackPos As Integer
End Structure
<StructLayout(LayoutKind.Sequential)>
Public Structure SCROLLBARINFO
Public CB_Size As Integer
Public RC_ScrollBar As RECT
Public DXY_LineButton As Integer
Public XY_ThumbTop As Integer
Public XY_ThumbBottom As Integer
Public Reserved As Integer
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=6, ArraySubType:=UnmanagedType.U4)>
Public RgState() As Integer
End Structure
#End Region
End Module
End Namespace