예제 #1
0
        private void unlock_socket_tread()
        {
            Socket        Server_s = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            IPEndPoint    iplocal  = new IPEndPoint(IPAddress.Any, 9988);
            Socket        client_s;
            IPEndPoint    newclient;
            ASCIIEncoding asen = new ASCIIEncoding();

            byte[] data = new byte[512];

            Server_s.Bind(iplocal);
            Server_s.Listen(1);
            client_s  = Server_s.Accept();
            newclient = (IPEndPoint)client_s.RemoteEndPoint;

            client_s.Receive(data);

            STATE = System.Text.Encoding.UTF8.GetString(data);

            if (int.Parse(STATE) == 0)
            {
                MouseBlockUnlock();
                InterceptMouse.End();

                Kill.Abort();
                this.Invoke(new MethodInvoker(delegate() { this.Visible = false; }));
                MessageBox.Show(STATE);

                Server_s.Close();
                this.Invoke(new MethodInvoker(delegate() { this.timer_event(); }));
            }

            Server_s.Close();
        }                                       // 서버로써 클라이언트에서 언락 데이터 받음
예제 #2
0
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)        // 키보드 후킹
        {
            if (keyData == (Keys.Alt | Keys.F4))
            {
                MouseBlockUnlock();
                InterceptMouse.End();

                Kill.Abort();

                this.Visible = false;

                MessageBox.Show("Alt + F4 catched!");
                //MessageBox.Show(GetMacAddress() + " " + GetIPAddress());

                timer_event();
                return(true);
            }

            else
            {
                return(base.ProcessCmdKey(ref msg, keyData));
            }
        }