Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than comctl32, prefix the name with the module name and a period.
DoReaderMode (comctl32)
.
C# Signature:
[DllImport("comctl32.dll", SetLastError=true)]
static extern TODO DoReaderMode(TODO);
VB Signature:
<DllImport("Comctl32.dll", EntryPoint:="#383", _
CallingConvention:=CallingConvention.StdCall)> _
Private Shared Sub DoReaderMode(ByRef prmi As READERMODEINFO)
<DllImport("Comctl32.dll", EntryPoint:="#383", _
CallingConvention:=CallingConvention.StdCall)> _
Private Shared Sub DoReaderMode(ByRef prmi As READERMODEINFO)
End Sub
<StructLayout(LayoutKind.Sequential)>
Private Structure READERMODEINFO
Dim cbSize As UInt32
Dim hwnd As IntPtr
Dim fFlags As UInt32
Dim prc As IntPtr
Dim pfnScroll As ReaderScrollCallbackDelegate
Dim fFlags2 As TranslateDispatchCallbackDelegate
Dim lParam As IntPtr
End Structure
Private Sub SetReaderMode()
Dim SetReaderModeInfo As READERMODEINFO
Dim rect As New RECT(Me.Width / 2 - 20, Me.Height / 2 - 20, Me.Width / 2 + 20, Me.Height / 2 + 20)
Dim pnt As IntPtr = Marshal.AllocHGlobal(Marshal.SizeOf(rect))
Marshal.StructureToPtr(rect, pnt, True)
SetReaderModeInfo = New READERMODEINFO
SetReaderModeInfo.hwnd = Me.Handle
SetReaderModeInfo.fFlags = 1
SetReaderModeInfo.prc = pnt
SetReaderModeInfo.pfnScroll = New ReaderScrollCallbackDelegate(AddressOf ReaderScrollCallback)
SetReaderModeInfo.fFlags2 = New TranslateDispatchCallbackDelegate(AddressOf TranslateDispatchCallback)
SetReaderModeInfo.lParam = IntPtr.Zero
SetReaderModeInfo.cbSize = Marshal.SizeOf(SetReaderModeInfo)
DoReaderMode(SetReaderModeInfo)
Marshal.FreeHGlobal(pnt)
End Sub
Private Delegate Function ReaderScrollCallbackDelegate(ByRef prmi As READERMODEINFO, dx As Integer, dy As Integer) As Boolean
Private Delegate Function TranslateDispatchCallbackDelegate(ByRef lpmsg As MSG) As Boolean
Private Function TranslateDispatchCallback(ByRef lpmsg As MSG) As Boolean
Return False
End Function
Dim CallCount As Integer = 0
Private Function ReaderScrollCallback(ByRef prmi As READERMODEINFO, dx As Int32, dy As Int32) As Boolean
HScrollPos += (dx)
VScrollPos += (dy)
CallCount += 1
If CallCount > 5 Then
Invalidate()
CallCount = 0
End If
Return True
End Function
<DllImport("user32.dll", CharSet:=CharSet.Auto)> _
Public Shared Function GetScrollPos(ByVal hWnd As IntPtr, ByVal nBar As Integer) As Integer
End Function
<DllImport("user32.dll")> _
Private Shared Function SetScrollPos(ByVal hWnd As IntPtr, ByVal nBar As Integer, ByVal nPos As Integer, ByVal bRedraw As Boolean) As Integer
End Function
Private Const SB_HORZ As Integer = &H0
Private Const SB_VERT As Integer = &H1
''' <summary>
''' Gets and Sets the Horizontal Scroll position of the control.
''' </summary>
Public Property HScrollPos() As Integer
Get
Return GetScrollPos(Me.Handle, SB_HORZ)
End Get
Set(ByVal value As Integer)
SetScrollPos(Me.Handle, SB_HORZ, value, True)
End Set
End Property
''' <summary>
''' Gets and Sets the Vertical Scroll position of the control.
''' </summary>
Public Property VScrollPos() As Integer
Get
Return GetScrollPos(Me.Handle, SB_VERT)
End Get
Set(ByVal value As Integer)
SetScrollPos(Me.Handle, SB_VERT, value, True)
End Set
End Property
TODO - a short description
6/8/2011 9:29:28 AM - CodeRed-207.230.208.250
TODO - a short description
6/8/2011 9:29:28 AM - CodeRed-207.230.208.250
The RECT structure defines the coordinates of the upper-left and lower-right corners of a rectangle.
6/3/2013 5:41:04 PM - dahminator-75.174.65.168
MSG structure (user32.dll)
8/15/2020 4:59:25 AM - Drarig29-93.23.131.77
Please edit this page!
Do you have...
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).