コード例 #1
0
 public bool PreFilterTransaction(DdemlTransaction t)
 {
     if (t.uType == Ddeml.XTYP_MONITOR) 
     {
         switch (t.dwData2.ToInt32())
         {
             case Ddeml.MF_CALLBACKS:
             {
                 // Get the MONCBSTRUCT object.
                 int length = 0;
                 IntPtr phData = Ddeml.DdeAccessData(t.hData, ref length);
                 Ddeml.MONCBSTRUCT mon = (Ddeml.MONCBSTRUCT)Marshal.PtrToStructure(phData, typeof(Ddeml.MONCBSTRUCT));
                 Ddeml.DdeUnaccessData(t.hData);
                 _Parent.OnCallback(mon);
                 break;
             }
             case Ddeml.MF_CONV:
             {
                 // Get the MONCONVSTRUCT object.
                 int length = 0;
                 IntPtr phData = Ddeml.DdeAccessData(t.hData, ref length);
                 Ddeml.MONCONVSTRUCT mon = (Ddeml.MONCONVSTRUCT)Marshal.PtrToStructure(phData, typeof(Ddeml.MONCONVSTRUCT));
                 Ddeml.DdeUnaccessData(t.hData);
                 _Parent.OnConversation(mon);
                 break;
             }
             case Ddeml.MF_ERRORS:
             {
                 // Get the MONERRSTRUCT object.
                 int length = 0;
                 IntPtr phData = Ddeml.DdeAccessData(t.hData, ref length);
                 Ddeml.MONERRSTRUCT mon = (Ddeml.MONERRSTRUCT)Marshal.PtrToStructure(phData, typeof(Ddeml.MONERRSTRUCT));
                 Ddeml.DdeUnaccessData(t.hData);
                 _Parent.OnError(mon);
                 break;
             }
             case Ddeml.MF_HSZ_INFO:
             {
                 // Get the MONHSZSTRUCT object.
                 int length = 0;
                 IntPtr phData = Ddeml.DdeAccessData(t.hData, ref length);
                 Ddeml.MONHSZSTRUCT mon = (Ddeml.MONHSZSTRUCT)Marshal.PtrToStructure(phData, typeof(Ddeml.MONHSZSTRUCT));
                 Ddeml.DdeUnaccessData(t.hData);
                 _Parent.OnString(mon);
                 break;
             }
             case Ddeml.MF_LINKS:
             {
                 // Get the MONLINKSTRUCT object.
                 int length = 0;
                 IntPtr phData = Ddeml.DdeAccessData(t.hData, ref length);
                 Ddeml.MONLINKSTRUCT mon = (Ddeml.MONLINKSTRUCT)Marshal.PtrToStructure(phData, typeof(Ddeml.MONLINKSTRUCT));
                 Ddeml.DdeUnaccessData(t.hData);
                 _Parent.OnLink(mon);
                 break;
             }
             case Ddeml.MF_POSTMSGS:
             {
                 // Get the MONMSGSTRUCT object.
                 int length = 0;
                 IntPtr phData = Ddeml.DdeAccessData(t.hData, ref length);
                 Ddeml.MONMSGSTRUCT mon = (Ddeml.MONMSGSTRUCT)Marshal.PtrToStructure(phData, typeof(Ddeml.MONMSGSTRUCT));
                 Ddeml.DdeUnaccessData(t.hData);
                 _Parent.OnPost(mon);
                 break;
             }
             case Ddeml.MF_SENDMSGS:
             {
                 // Get the MONMSGSTRUCT object.
                 int length = 0;
                 IntPtr phData = Ddeml.DdeAccessData(t.hData, ref length);
                 Ddeml.MONMSGSTRUCT mon = (Ddeml.MONMSGSTRUCT)Marshal.PtrToStructure(phData, typeof(Ddeml.MONMSGSTRUCT));
                 Ddeml.DdeUnaccessData(t.hData);
                 _Parent.OnSend(mon);
                 break;
             }
         }
     }			
     return true;
 }