Hi
Hannes,
I modified your code to the following code snippet. In this scenario the improper parameter marshaling doesn't call this function successfully. I read the code exmaple from here to modify your code. Now it works properly. Hope this helps.
Imports System.Runtime.InteropServices
Public Class Form1
Private Const SPI_GETFILTERKEYS = 50
Private SPI_SETFILTERKEYS As Integer = 51
Private FKF_FILTERKEYSON As Integer = 1
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Auto)> _
Public Structure FILTERKEYS
Public cbSize As UInt16
Public dwFlags As Integer
Public iWaitMSec As Integer
Public iDelayMSec As Integer
Public iRepeatMSec As Integer
Public iBounceMSec As Integer
End Structure
<DllImport("user32", CharSet:=CharSet.Auto)> _
Private Shared Function SystemParametersInfo(ByVal uAction As Integer, ByVal uParam As Integer, ByRef lpvParam As FILTERKEYS, ByVal fuWinIni As Integer) As Integer
End Function
Private oldfilterkeys As New FILTERKEYS()
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
oldfilterkeys.cbSize = Marshal.SizeOf(GetType(FILTERKEYS))
Dim result As Boolean = SystemParametersInfo(SPI_GETFILTERKEYS, 0, oldfilterkeys, 0)
MessageBox.Show(result.ToString)
MessageBox.Show(oldfilterkeys.iDelayMSec.ToString)
End Sub
End Class
Best regards,
Riquel