public static void getMonitorInfos() { screenNum = 0; listener = new MonitorInfosCallback(onMonitorInfoCallback); mMonitorInfos = new HNStruct.MONITORINFOEX[10]; HuionDriverDLL.EnumDisplayMonitors(IntPtr.Zero, IntPtr.Zero, listener, IntPtr.Zero); int num1 = Marshal.SizeOf(typeof(HNStruct.MONITORINFOEX)); IntPtr num2 = Marshal.AllocHGlobal(num1 * 10); long num3 = 0; switch (IntPtr.Size) { case 4: num3 = (long)num2.ToInt32(); break; case 8: num3 = num2.ToInt64(); break; } for (int index = 0; index < 10; ++index) { Marshal.StructureToPtr((object)mMonitorInfos[index], new IntPtr(num3), false); num3 += (long)num1; } HuionDriverDLL.hnd_refresh_monitors(num2, (uint)screenNum); Marshal.FreeHGlobal(num2); }
public static extern bool EnumDisplayMonitors(IntPtr hdc, IntPtr lprcClip, MonitorInfosCallback lpfnEnum, IntPtr dwData);