コード例 #1
0
ファイル: DdemlContext.cs プロジェクト: zhangjk1980/NDde
            public static int Initialize(Ddeml.DdeCallback pfnCallback, int afCmd)
            {
                lock (_Table) 
                {
                    // Initialize a DDEML instance.
                    int instanceId = 0;
                    Ddeml.DdeInitialize(ref instanceId, pfnCallback, afCmd, 0);
                    
                    if (instanceId != 0)
                    {
                        // Make sure this thread has an IMessageFilter on it.
                        LocalDataStoreSlot slot = Thread.GetNamedDataSlot(DataSlot);
                        if (Thread.GetData(slot) == null) 
                        {
                            InstanceManager filter = new InstanceManager();
                            Application.AddMessageFilter(filter);
                            Thread.SetData(slot, filter);
                        }

                        // Add an entry to the table that maps the instance identifier to the current thread.
                        _Table.Add(instanceId, Ddeml.GetCurrentThreadId());
                    }
                    
                    return instanceId;
                }
            }
コード例 #2
0
        private WeakReferenceDictionary<string, DdemlServer> _ServerTable2 = new WeakReferenceDictionary<string, DdemlServer>(); // Active servers by service

        #endregion Fields

        #region Constructors

        public DdemlContext()
        {
            // Create the callback that will be used by the DDEML.
            _Callback = this.ODdeNetCallback;
        }
コード例 #3
0
ファイル: DdemlContext.cs プロジェクト: zhangjk1980/NDde
 public DdemlContext()
 {
     // Create the callback that will be used by the DDEML.
     _Callback = this.OnDdeCallback;
 }