예제 #1
0
        protected override void DefWndProc(ref System.Windows.Forms.Message m)
        {
            switch (m.Msg)
            {
            case WM_COPYDATA:
                COPYDATASTRUCT mystr  = new COPYDATASTRUCT();
                Type           mytype = mystr.GetType();
                mystr = (COPYDATASTRUCT)m.GetLParam(mytype);
                WndProcAgreement comm = StrToObject(mystr.lpData);
                if (comm.Identifier == WndProcAgreement_Identifiter.Activate)
                {
                    Console.WriteLine(comm.Identifier);
                    this.Activate();
                    //this.Close();
                }
                else if (comm.Identifier == WndProcAgreement_Identifiter.Close)
                {
                    this.Close();
                }
                break;

            default:
                base.DefWndProc(ref m);
                break;
            }
        }
예제 #2
0
        //json串解析成对象
        public WndProcAgreement StrToObject(string s)
        {
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            WndProcAgreement     comm       = serializer.Deserialize <WndProcAgreement>(s);

            return(comm);
        }
예제 #3
0
 private void ContainerForm_DefWndProcEvent(ref Message msg)
 {
     switch (msg.Msg)
     {
     case WM_COPYDATA:
         COPYDATASTRUCT mystr  = new COPYDATASTRUCT();
         Type           mytype = mystr.GetType();
         mystr = (COPYDATASTRUCT)msg.GetLParam(mytype);
         WndProcAgreement comm = StrToObject(mystr.lpData);
         if (comm.Identifier == WndProcAgreement_Identifiter.Activate)
         {
             this.ContainerForm.Activate();
         }
         else if (comm.Identifier == WndProcAgreement_Identifiter.Close)
         {
             this.Close();
         }
         else if (comm.Identifier == WndProcAgreement_Identifiter.FlipScreens)
         {
         }
         break;
     }
 }