public static extern uint midiOutOpen(
    out IntPtr lphmo,
        int uDeviceID,
        MidiOutProc dwCallback,
        int dwCallbackInstance,
        CALLBACK dwFlags
    );
Exemple #2
0
    private void Init(float interval, CALLBACK callback, bool loop = false, System.Object parameter = null)
    {
        _interval  = interval;
        _callback  = callback;
        _loop      = loop;
        _parameter = parameter;

        _timestamp = TimeHelper.GetCurrentRealTimestamp();
    }
Exemple #3
0
 public CDPWorkerObject(LivePacketDevice sd, CALLBACK cb)
 {
     try
     {
         selectedDevice = sd;
         callBack       = cb;
         communicator   = selectedDevice.Open(512, PacketDeviceOpenAttributes.Promiscuous, 1000);
         capturedPacket = null;
     }
     catch (Exception)
     {
     }
 }
 public static void Init()
 {
     if (Environment.OSVersion.Platform == PlatformID.Win32NT
      || Environment.OSVersion.Platform == PlatformID.Win32S
      || Environment.OSVersion.Platform == PlatformID.Win32Windows
      || Environment.OSVersion.Platform == PlatformID.WinCE)
     {
     m_callback = OnKey; // Keep a reference on OnKey
     m_hook = NativeMethods.SetWindowsHookEx(WH.KEYBOARD_LL, m_callback,
                            NativeMethods.LoadLibrary("user32.dll"), 0);
     if (m_hook == HOOK.INVALID)
         throw new Win32Exception(Marshal.GetLastWin32Error());
     }
 }
Exemple #5
0
    public static void Fire(string name, object[] args)
    {
        DelegateObjList dol;

        if (globe.eventTable.TryGetValue(name, out dol))
        {
            dol.Enter();
            int count = dol.events.Count;
            for (int i = 0; i < count; ++i)
            {
                CALLBACK callback = dol.events[i] as CALLBACK;
                callback(args);
            }
            dol.Leave();
        }
    }
Exemple #6
0
        private void InteropCppToCSharpButton_Click(object sender, RoutedEventArgs e)
        {
            //Set callback so C++ can call back to C#.
            _callback = Callback;
            SetCallback(_callback);
            //
            System.Int32  size = 256;
            System.Byte[] str  = new byte[size];
            for (int i = 0; i < size; i++)
            {
                str[i] = (byte)'1';
            }

            GetCSharpText(str, out size);
            string result = System.Text.Encoding.UTF8.GetString(str, 0, size);

            InteropCppToCSharpButtonTextBox.Text = result;
        }
Exemple #7
0
    public static TimerEx Init(string timerName, float interval, CALLBACK callback, bool loop = false, System.Object parameter = null)
    {
        if (_timerRoot == null)
        {
            _timerRoot = new GameObject("TimerSpawn");
            MonoBehaviour.DontDestroyOnLoad(_timerRoot);
        }

        GameObject gameObject = new GameObject(TIMEREX_NAME_PREFIX + timerName);

        MonoBehaviour.DontDestroyOnLoad(gameObject);
        gameObject.transform.parent = _timerRoot.transform;

        TimerEx t = gameObject.AddComponent <TimerEx>();

        if (t != null)
        {
            t.Init(interval, callback, loop, parameter);
            return(t);
        }
        return(null);
    }
Exemple #8
0
    public void Listen(string name, CALLBACK handler)
    {
        if (handler == null)
        {
            return;
        }

        DelegateObjList dol;

        if (!eventTable.TryGetValue(name, out dol))
        {
            dol = new DelegateObjList();
            eventTable.Add(name, dol);
        }

        dol.Add(handler);

        if (parent != null)
        {
            parent.Listen(name, handler);
        }
    }
Exemple #9
0
 public static extern HOOK SetWindowsHookEx(WH idHook, CALLBACK lpfn,
                                            IntPtr hMod, int dwThreadId);
Exemple #10
0
 internal static extern Int32 McRegisterCallback(UInt32 instance, CALLBACK callbackFunction, UInt32 context);
Exemple #11
0
 public static void RegisterCallback(UInt32 instance, CALLBACK callbackFunction, UInt32 context)
 {
     ThrowOnMultiCamError(NativeMethods.McRegisterCallback(instance, callbackFunction, context),
                          "Cannot register callback");
 }
Exemple #12
0
 static extern void SetCallback(CALLBACK callback);
 internal static extern bool MP4Net_ClientRegisterDrawFun(int StockHandle, CALLBACK DrawFun, int nUser);
Exemple #14
0
 public static extern HOOK SetWindowsHookEx(WH idHook, CALLBACK lpfn,
                                             IntPtr hMod, int dwThreadId);
Exemple #15
0
 public static extern int EnumWindows(CALLBACK x, int y);
Exemple #16
0
        public void GetHwd()
        {
            CALLBACK myCallBack = new CALLBACK(Report);

            EnumWindows(myCallBack, 0);
        }
Exemple #17
0
 public CDPWorkerObject(LivePacketDevice sd, CALLBACK cb)
 {
     try
     {
         selectedDevice = sd;
         callBack = cb;
         communicator = selectedDevice.Open(512, PacketDeviceOpenAttributes.Promiscuous, 1000);
         capturedPacket = null;
     }
     catch (Exception)
     {
     }
 }
Exemple #18
-1
 public static void Fini()
 {
     // XXX: this will crash if called from the GC Finalizer Thread because
     // the hook needs to be removed from the same thread that installed it.
     if (m_hook != HOOK.INVALID)
     {
     int ret = NativeMethods.UnhookWindowsHookEx(m_hook);
     if (ret == 0)
         throw new Win32Exception(Marshal.GetLastWin32Error());
     m_hook = HOOK.INVALID;
     }
     m_callback = null;
 }