Overflow checking really gets in the way here. The best way to tackle this problem is by declaring a union. A union is a structure that has overlapping values. Which elegantly allows you to overlay an IntPtr on top of structure members that have type Short. The conversion is extremely fast and cannot throw an overflow exception.
Add a new Module to your project, name it NativeMethods and make it look like this:
Imports System.Runtime.InteropServices
Imports System.Drawing
Module NativeMethods
<StructLayout(LayoutKind.Explicit)> _
Public Structure LParamMap
Public Sub New(value As IntPtr)
lparam = value
End Sub
Public Shared Widening Operator CType(value As LParamMap) As Point
Return New Point(value.loword, value.hiword)
End Operator
<FieldOffset(0)> Public lparam As IntPtr
<FieldOffset(0)> Public loword As Short
<FieldOffset(2)> Public hiword As Short
End Structure
End Module
I threw in a conversion operator for Point since that's the one you really want. Some test code that exercises this:
Imports System.Drawing
Imports System.Diagnostics
Module Module1
Sub Main()
Debug.Assert(BitConverter.IsLittleEndian)
Dim test As New LParamMap(New IntPtr(-1))
Debug.Assert(test.loword = -1)
Debug.Assert(test.hiword = -1)
Dim pos As Point = test
Debug.Assert(pos = New Point(-1, -1))
End Sub
End Module
It now becomes a very simple one-liner in, say, an override of a form's WndProc() method:
Protected Overrides Sub WndProc(ByRef m As Windows.Forms.Message)
If m.Msg = &H200 Then
Dim pos As Point = New LParamMap(m.LParam)
'' etc...
End If
MyBase.WndProc(m)
End Sub