public static void FilterKey(MainWindow.FilterKeyStruct fk) { int size = fk.cbSize; IntPtr metrics = Marshal.AllocHGlobal(size); Marshal.StructureToPtr(fk, metrics, true); User32.SystemParametersInfo(51, size, metrics, 0); }
public static MainWindow.FilterKeyStruct FilterKey() { MainWindow.FilterKeyStruct startupFilterKeys = new MainWindow.FilterKeyStruct(); int size = startupFilterKeys.cbSize = Marshal.SizeOf(typeof(MainWindow.FilterKeyStruct)); IntPtr metrics = Marshal.AllocHGlobal(size); Marshal.StructureToPtr(startupFilterKeys, metrics, true); bool b = User32.SystemParametersInfo(50, size, metrics, 0); MainWindow.FilterKeyStruct result = (MainWindow.FilterKeyStruct)Marshal.PtrToStructure(metrics, typeof(MainWindow.FilterKeyStruct)); Marshal.FreeHGlobal(metrics); return(result); }