Ejemplo n.º 1
0
        protected override void Load()
        {
            mmi = MMInterface.GetMMI();
            Database = new DatabaseConnector();

            this.HookEvent("DB/Event/Added", eventAdded);
            this.HookEvent("CList/DoubleClicked", cListDoubleClicked);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Method for obtaining all these function pointers.
        /// </summary>
        /// <returns>
        /// Valid managed MMInterface object.
        /// </returns>
        public static MMInterface GetMMI()
        {
            var mmi = new MMInterface();

            // Put structure to unmanaged memory:
            IntPtr pMMInterface =
                Marshal.AllocHGlobal(Marshal.SizeOf(typeof (MMInterface)));
            Marshal.StructureToPtr(mmi, pMMInterface, false);

            Plugin.m_CallService(
                "Miranda/System/GetMMI",
                IntPtr.Zero,
                pMMInterface);

            // Get structure back from unmanaged memory:
            mmi = (MMInterface)Marshal.PtrToStructure(pMMInterface,
                typeof (MMInterface));

            // Free allocated unmanaged memory:
            Marshal.FreeHGlobal(pMMInterface);

            return mmi;
        }