using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace XinYuConnectionServer
{
    public class ExitMessageFilter : System.Windows.Forms.IMessageFilter
    {
        private Form  frm;
        public ExitMessageFilter(Form  frm)
        {
            this.frm = frm;
        }

        #region IMessageFilter 成员

        public bool PreFilterMessage(ref Message m)
        {
            if (frm == null)
            {

            }

            if (m.Msg == 16)
            {

                StreamWriter sw = new StreamWriter("c:\\123.txt", true, Encoding.UTF8);
                sw.Write(string.Format("{0}",m.LParam));
                    sw.Close();
                sw.Dispose();
               
          
                return false;
            }
            else
            {
                return false;
            }
        }


        #endregion
    }

}
