Option Explicit On Option Strict On Imports System.Runtime.InteropServices Module Module1 Public Declare Function SystemParametersInfo Lib "USER32" Alias "SystemParametersInfoW" _ (ByVal uiAction As UInteger, _ ByVal uiParam As UInteger, _ ByRef pvParam As UInteger, _ ByVal fWinIni As UInteger) As Boolean Public Declare Function SystemParametersInfo Lib "USER32" Alias "SystemParametersInfoW" _ (ByVal uiAction As UInteger, _ ByVal uiParam As UInteger, _ ByVal pvParam As IntPtr, _ ByVal fWinIni As UInteger) As Boolean Public Const SPI_GETFOREGROUNDLOCKTIMEOUT As UInteger = &H2000 Public Const SPI_SETFOREGROUNDLOCKTIMEOUT As UInteger = &H2001 Sub Main() Dim oldValue As UInteger = 2345UI 'dummy value SystemParametersInfo(SPI_GETFOREGROUNDLOCKTIMEOUT, 0UI, oldValue, 0UI) '☆A Console.WriteLine(oldValue) 'Dim value32 As Integer = 3456I 'dummy value 'Dim p1 As IntPtr = Marshal.AllocHGlobal(IntPtr.Size) 'Marshal.WriteInt32(p1, value32) 'SystemParametersInfo(SPI_GETFOREGROUNDLOCKTIMEOUT, 0UI, p1, 0UI) '☆B 'value32 = Marshal.ReadInt32(p1) 'Marshal.FreeHGlobal(p1) 'Console.WriteLine(oldValue) 'SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0UI, New IntPtr(20002), 1UI) '★C 'SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0UI, New IntPtr(&H3579B), 0UI) '★D End Sub End Module