<DllImport("user32.dll", EntryPoint:="SetWindowLong")> 
   Public Function SetWindowLong32(
        ByVal hWnd As IntPtr,
        <MarshalAs(UnmanagedType.I4)> nIndex As WindowLongFlags,
        ByVal dwNewLong As Integer) As Integer
    End Function
    <DllImport("user32.dll", EntryPoint:="SetWindowLongPtr")>
    Public Function SetWindowLongPtr64(
        ByVal hWnd As IntPtr,
        <MarshalAs(UnmanagedType.I4)> nIndex As WindowLongFlags,
        ByVal dwNewLong As IntPtr) As IntPtr
    End Function
    Public Function SetWindowLongPtr(ByVal hWnd As IntPtr, nIndex As WindowLongFlags, ByVal dwNewLong As IntPtr) As IntPtr
        If IntPtr.Size = 8 Then
            Return SetWindowLongPtr64(hWnd, nIndex, dwNewLong)
        Else
            Return New IntPtr(SetWindowLong32(hWnd, nIndex, dwNewLong.ToInt32))
        End If
    End Function
    
    <DllImport("user32.dll", EntryPoint:="GetWindowLong")>
    Public Function GetWindowLongPtr32(ByVal hWnd As IntPtr, ByVal nIndex As Integer) As IntPtr
    End Function
    <DllImport("user32.dll", EntryPoint:="GetWindowLongPtr")>
    Public Function GetWindowLongPtr64(ByVal hWnd As IntPtr, ByVal nIndex As Integer) As IntPtr
    End Function
    Public Function GetWindowLongPtr(ByVal hWnd As IntPtr, ByVal nIndex As Integer) As IntPtr
        If IntPtr.Size = 8 Then
            Return GetWindowLongPtr64(hWnd, nIndex)
        Else
            Return GetWindowLongPtr32(hWnd, nIndex)
        End If
    End Function