Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DCC- monitor

i found this, i have no idea how it would look in qm3 to even begin. Could this is also work in qm2. any help will be appreciated.
The code is C++. QM supports only C#.
If it compiles to exe, both QM2 and 3 can run it.
If it compiles to a dll with C API (not C++ API), both QM2 and 3 can use it.
Thanks for that.
I wanted to be be able to change some of the code for what i wanted to do (change picture modes, process takes ages to get from standard to FPS), and thought it would be a good starting point for syntax, but as its c++ that explains why copy and paste didnt work. and as qm3 is new to me i didnt see it was a different language.
The main exe was posted along with source code, and thought it would suit my needs with very little adaption.
can this be converted to QM2?

C# code:
using System; using System.Collections.Generic;
using System.Runtime.InteropServices;

namespace swmon

    class Program
        static void Main(string[] args)
            IntPtr hMonitor = MonitorFromWindow(IntPtr.Zero, MONITOR_DEFAULTTO.PRIMARY);

            // get number of physical displays (assume only one for simplicity)
            uint physicalMonitorCount = 0;
            GetNumberOfPhysicalMonitorsFromHMONITOR(hMonitor, out physicalMonitorCount);

            Physical_Monitor pmon = new Physical_Monitor();

            bool success = GetPhysicalMonitorsFromHMONITOR(hMonitor, physicalMonitorCount, ref pmon);

            success = SetVCPFeature(pmon.hPhysicalMonitor, (byte)0xDC, 21);
            success = DestroyPhysicalMonitors(physicalMonitorCount, ref pmon);


        private const int PHYSICAL_MONITOR_DESCRIPTION_SIZE = 128;

        internal static extern IntPtr MonitorFromWindow(IntPtr hwnd, MONITOR_DEFAULTTO dwFlags);

        private static extern bool GetNumberOfPhysicalMonitorsFromHMONITOR(IntPtr hMonitor, out uint pdwNumberOfPhysicalMonitors);

        private static extern bool GetPhysicalMonitorsFromHMONITOR(IntPtr hMonitor, uint dwPhysicalMonitorArraySize, ref Physical_Monitor physicalMonitorArray);

        private static extern bool DestroyPhysicalMonitors(uint dwPhysicalMonitorArraySize, ref Physical_Monitor physicalMonitorArray);

        private static extern bool SetVCPFeature(IntPtr hMonitor, byte bVCPCode, int dwNewValue);

        /// <summary>
        /// Used for features with continuous values (values that can be anything in [0, maxValue]).
        /// </summary>
        private static extern bool GetVCPFeatureAndVCPFeatureReply(IntPtr hMonitor, byte bVCPCode, ref IntPtr makeNull, out int currentValue, out int maxValue);

        private struct Physical_Monitor
            public IntPtr hPhysicalMonitor;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = PHYSICAL_MONITOR_DESCRIPTION_SIZE)]
            public string szPhysicalMonitorDescription;

        internal enum MONITOR_DEFAULTTO
            NULL = 0x00000000,
            PRIMARY = 0x00000001,
            NEAREST = 0x00000002,

Forum Jump:

Users browsing this thread: 1 Guest(s)