Beispiel #1
0
            public static void Uninitialize(int instanceId)
            {
                // This method could be called by the GC finalizer thread.  If it is then a direct call to the DDEML will fail since the DDEML is 
                // thread specific.  A message will be posted to the DDEML thread instead.
                lock (_Table) 
                {
                    if (_Table.ContainsKey(instanceId))
                    {
                        // Determine if the current thread matches what is in the table.
                        int threadId = (int)_Table[instanceId];
                        if (threadId == Ddeml.GetCurrentThreadId())
                        {
                            // Uninitialize the DDEML instance.
                            Ddeml.DdeUninitialize(instanceId);
                        }
                        else
                        {
                            // Post a message to the thread that needs to execute Ddeml.DdeUninitialize.
                            PostThreadMessage(threadId, WM_APP + 1, new IntPtr(instanceId), IntPtr.Zero);
                        }

                        // Remove the instance identifier from the table because it is no longer in use.
                        _Table.Remove(instanceId);
                    }
                }
            }
Beispiel #2
0
 bool IMessageFilter.PreFilterMessage(ref Message m)
 {
     if (m.Msg == WM_APP + 1)
     {
         // Uninitialize the DDEML instance.
         Ddeml.DdeUninitialize(m.WParam.ToInt32());
     }
     return false;
 }
 bool IMessageFilter.PreFilterMessage(ref Message m)
 {
     if (m.Msg == WM_APP + 1)
         Ddeml.DdeUninitialize(m.WParam.ToInt32());
     return false;
 }