当前位置:编程学习 > C#/ASP.NET >>

一句话的恶搞程序!

 private void Form2_MouseEnter(object sender, EventArgs e)
        {
            Form2 second = new Form2();
            second.Show();
        } --------------------编程问答-------------------- 请问只是什么啊。 --------------------编程问答-------------------- 标题党。 --------------------编程问答-------------------- 标题党。 --------------------编程问答-------------------- 是不是不断地打开新的window。 --------------------编程问答-------------------- .......... --------------------编程问答-------------------- 好高深的问题。。。看不懂地。。哈哈~
路过。。骚扰下! --------------------编程问答-------------------- 是不是鼠标点一下就会不断的弹出窗口? --------------------编程问答-------------------- 一个吧 --------------------编程问答--------------------
引用 7 楼 duanzhanyang 的回复:
是不是鼠标点一下就会不断的弹出窗口?

不是点一下 是鼠标移动到上面就会, 为什么不直接在form load事件里写? --------------------编程问答-------------------- --------------------编程问答-------------------- Form2_MouseEnter



--------------------编程问答-------------------- 鼠标放上去就不停地打开一个窗口,貌似你忽略了一点,新打开的窗口会成为焦点,而不会再新打开窗口了.
所以还不如搞个死循环来得快些. --------------------编程问答--------------------
引用 12 楼 foxwfb 的回复:
鼠标放上去就不停地打开一个窗口,貌似你忽略了一点,新打开的窗口会成为焦点,而不会再新打开窗口了.
所以还不如搞个死循环来得快些.


没有,他是写在 Form2_MouseEnter中的,生成的新的也是 Form2 ,不过,愚人节过了吧。。。。 --------------------编程问答-------------------- 鼠标点一下,弹出窗口!! --------------------编程问答-------------------- 路过... --------------------编程问答-------------------- 哈哈,有才呀 --------------------编程问答-------------------- 呵呵,这个程序还不算恶搞啊。。。。 --------------------编程问答-------------------- 循环啊循环,人家要是没.NET环境怎么办? --------------------编程问答-------------------- 看不懂唉。。。 --------------------编程问答-------------------- MouseEnter 事件 是当鼠标进入控件的可见部分发生。
   估计鼠标在界面上走一圈,你的页面就开了几十个了。 --------------------编程问答-------------------- 要不要试一下? --------------------编程问答--------------------   触发鼠标点击时间 --------------------编程问答-------------------- 路过... --------------------编程问答-------------------- 看不懂, --------------------编程问答-------------------- 标题党。 --------------------编程问答-------------------- 标题党。。 --------------------编程问答-------------------- 看看了! --------------------编程问答-------------------- 看不懂 --------------------编程问答-------------------- 看不懂。总觉得做软件的都是牛人 --------------------编程问答-------------------- 无限窗口囧.
--------------------编程问答--------------------

label:
new Form().Show();
goto label;

--------------------编程问答-------------------- 牛人啊 --------------------编程问答-------------------- 看不懂。总觉得做软件的都是牛人 --------------------编程问答-------------------- 没看出来怎么恶搞  还不如shutdown -s -t1 来个彻底 --------------------编程问答-------------------- 不太懂耶,谁能给我讲讲?
--------------------编程问答-------------------- 鼠标放上就触发这个很好实现估计你自己也会
你可以写个外部类加个静态变量BOOL类型就行,来控制 鼠标当前是否在任意一个窗体上。再就弹 不在就停止 --------------------编程问答-------------------- 路过。。。看看 --------------------编程问答-------------------- 这个好像不是一句话~! --------------------编程问答-------------------- 看不太明白啊! --------------------编程问答--------------------
引用 39 楼 qiqishardgel 的回复:
看不太明白啊!
GG --------------------编程问答-------------------- 我好为运行这段程序的电脑难过呀... --------------------编程问答--------------------
引用 31 楼 nixiang12 的回复:
C# code

label:
new Form().Show();
goto label;

这个够狠啊 --------------------编程问答-------------------- 很无聊的问题。 --------------------编程问答-------------------- 呵呵,强! --------------------编程问答--------------------
引用 18 楼 siegebaoniu 的回复:
循环啊循环,人家要是没.NET环境怎么办?

Error出现! --------------------编程问答-------------------- 点击鼠标,只显示一次FORM2!~


没技术含量~ --------------------编程问答-------------------- 不错,牛 --------------------编程问答--------------------  2012的悲剧终于预言了!我们也终于相信了玛雅人的预言。任何手机用自带的计算器时,用2012除以8.048,手机将会显示机主姓名……目前没有任何专家可以解释这一现象…… --------------------编程问答-------------------- 不用Click,只要鼠标进入form就会产生新form。 --------------------编程问答-------------------- 。。。。。。。。。。。。。。。。 --------------------编程问答-------------------- #46  看清  事件   
不是 点击 事件

囧 …………………… --------------------编程问答-------------------- 看不懂~ --------------------编程问答-------------------- 有意思,貌似楼上的哥们 goto 更强悍 --------------------编程问答-------------------- 这个不够狠,要开进程 --------------------编程问答--------------------
引用 4 楼 dogfish 的回复:
是不是不断地打开新的window。

没看出来 --------------------编程问答-------------------- 不过,那些vista 以下的系统就无法直接运行的 --------------------编程问答-------------------- 哎,无聊的人可真多啊,呵呵,额也是无聊的人 --------------------编程问答-------------------- .......................... --------------------编程问答-------------------- 我无语了,。。。。。。 --------------------编程问答-------------------- 额。。。会用VS的都看懂这代码意思了吧 --------------------编程问答-------------------- 比循环更YD --------------------编程问答-------------------- private void Form2_MouseEnter(object sender, EventArgs e)
  {
      MessageBox.Show("你被玩弄了");
  }

Was... --------------------编程问答-------------------- MessageBox.Show("为了方便此恶搞程序的运行,请上MS官网下载最新版的.NET FrameWork"); --------------------编程问答-------------------- Form2_MouseEnter? --------------------编程问答-------------------- ........................................... --------------------编程问答-------------------- 请问怎么看出是“一句话”的? --------------------编程问答-------------------- 这种东西ctrl alt del都可以结束啊。还不如在进程上做做文章。不知不觉把人弄蓝屏了。。。 --------------------编程问答-------------------- 算不上恶搞啊。 --------------------编程问答-------------------- form2类窗口上点一下 就又 弹出个 form2类窗口哦   这部怎么样 为什么 不把代码 放到 load 事件里呢? --------------------编程问答--------------------

using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace KeyHook
{
    public partial class Main : Form
    {
        private KeyPressCounter[] counter;
        private UserActivityHook hook;
        public Main()
        {
            InitializeComponent();
        }

        private void Main_Load(object sender, EventArgs e)
        {
            #region "按键数组"
            counter = new KeyPressCounter[]{
                new KeyPressCounter(Keys.A),//0
                new KeyPressCounter(Keys.B),//1
                new KeyPressCounter(Keys.C),//2
                new KeyPressCounter(Keys.D),//3
                new KeyPressCounter(Keys.E), //4
                new KeyPressCounter(Keys.F),//5
                new KeyPressCounter(Keys.G),//6
                new KeyPressCounter(Keys.H),//7
                new KeyPressCounter(Keys.I),//8
                new KeyPressCounter(Keys.J),//9
                new KeyPressCounter(Keys.K),//10
                new KeyPressCounter(Keys.L),//11
                new KeyPressCounter(Keys.M),//12
                new KeyPressCounter(Keys.N),//13
                new KeyPressCounter(Keys.O),//14
                new KeyPressCounter(Keys.P),//15
                new KeyPressCounter(Keys.Q),//16
                new KeyPressCounter(Keys.R),//17
                new KeyPressCounter(Keys.S),//18
                new KeyPressCounter(Keys.T),//19
                new KeyPressCounter(Keys.U),//20
                new KeyPressCounter(Keys.V),//21
                new KeyPressCounter(Keys.W),//22
                new KeyPressCounter(Keys.X),//23
                new KeyPressCounter(Keys.Y),//24
                new KeyPressCounter(Keys.Z),//25

                new KeyPressCounter(Keys.Back),//26
                new KeyPressCounter(Keys.Capital),//27 ------大小写
                new KeyPressCounter(Keys.ControlKey),//28 ------ Ctrl
                new KeyPressCounter(Keys.Delete),//29 ----- Delete
                new KeyPressCounter(Keys.Decimal),//30 ------ 句号
                new KeyPressCounter(Keys.Divide),//31 ------除
                new KeyPressCounter(Keys.End),//32 ----END
                new KeyPressCounter(Keys.Enter),//33 
                new KeyPressCounter(Keys.Escape),//34
                new KeyPressCounter(Keys.Home),//35 -----Home          
                new KeyPressCounter(Keys.Insert),//36
                new KeyPressCounter(Keys.LMenu),//37 -----左ALT
                new KeyPressCounter(Keys.RMenu),//38 -----右ALT
                new KeyPressCounter(Keys.LShiftKey),//39
                new KeyPressCounter(Keys.RShiftKey),//40
                new KeyPressCounter(Keys.LWin),//41
                new KeyPressCounter(Keys.RWin),//42
                new KeyPressCounter(Keys.PageDown),//43
                new KeyPressCounter(Keys.PageUp),//44
                new KeyPressCounter(Keys.Space),//45
                new KeyPressCounter(Keys.Subtract),//46
                new KeyPressCounter(Keys.Tab),
                new KeyPressCounter(Keys.Separator),

                new KeyPressCounter(Keys.NumLock),
                new KeyPressCounter(Keys.NumPad0),
                new KeyPressCounter(Keys.NumPad1),
                new KeyPressCounter(Keys.NumPad2),
                new KeyPressCounter(Keys.NumPad3),
                new KeyPressCounter(Keys.NumPad4),
                new KeyPressCounter(Keys.NumPad5),
                new KeyPressCounter(Keys.NumPad6),
                new KeyPressCounter(Keys.NumPad7),
                new KeyPressCounter(Keys.NumPad8),
                new KeyPressCounter(Keys.NumPad9),
  
                new KeyPressCounter(Keys.Up),
                new KeyPressCounter(Keys.Down),
                new KeyPressCounter(Keys.Left),
                new KeyPressCounter(Keys.Right),

                new KeyPressCounter(Keys.F1),
                new KeyPressCounter(Keys.F2),
                new KeyPressCounter(Keys.F3),
                new KeyPressCounter(Keys.F4),
                new KeyPressCounter(Keys.F5),
                new KeyPressCounter(Keys.F6),
                new KeyPressCounter(Keys.F7),
                new KeyPressCounter(Keys.F8),
                new KeyPressCounter(Keys.F9),
                new KeyPressCounter(Keys.F10),
                new KeyPressCounter(Keys.F11),
                new KeyPressCounter(Keys.F12),

                new KeyPressCounter(Keys.D0),
                new KeyPressCounter(Keys.D1),
                new KeyPressCounter(Keys.D2),
                new KeyPressCounter(Keys.D3),
                new KeyPressCounter(Keys.D4),
                new KeyPressCounter(Keys.D5),
                new KeyPressCounter(Keys.D6),
                new KeyPressCounter(Keys.D7),
                new KeyPressCounter(Keys.D8),
                new KeyPressCounter(Keys.D9)
            };
            #endregion
            hook = new UserActivityHook();
            hook.KeyDown += new KeyEventHandler(Hook_KeyDown);
        }

        private void Hook_KeyDown(object sender, EventArgs e)
        {
            MessageBox.Show("由于你人品问题,系统停止你用键盘!", "错误",
                MessageBoxButtons.OK,
                MessageBoxIcon.Error);
        }
    }
}


Main.cs --------------------编程问答--------------------

using System;

namespace KeyHook
{
    public class KeyPressCounter
    {
        private int count;
        private string key;

        public KeyPressCounter(System.Windows.Forms.Keys key)
        {
            this.count = 0;
            this.key = key.ToString();
        }

        public int Count
        {
            set
            {
                this.count = value;
            }
            get
            {
                return this.count;
            }
        }

        public string Key
        {
            get
            {
                return this.key;
            }
        }
    }
}

KeyPressCounter.cs --------------------编程问答--------------------

using System;
using System.Runtime.InteropServices;
using System.Reflection;
using System.Windows.Forms;

namespace KeyHook
{
    public class UserActivityHook : object
    {
        public UserActivityHook()
        {
            Start();
        }
        ~UserActivityHook()
        {
            Stop();
        }

        public event KeyEventHandler KeyDown;
        public event KeyPressEventHandler KeyPress;
        public event KeyEventHandler KeyUp;
        public delegate int HookProc(int nCode, Int32 wParam, IntPtr lParam);
        static int hKeyboardHook = 0; 
        public const int WH_KEYBOARD_LL = 13;
        HookProc KeyboardHookProcedure; 

        [StructLayout(LayoutKind.Sequential)]
        public class KeyboardHookStruct
        {
            public int vkCode;
            public int scanCode; 
            public int flags;  
            public int time;
            public int dwExtraInfo; 
        }

        [DllImport("user32.dll", CharSet = CharSet.Auto,
            CallingConvention = CallingConvention.StdCall)]
        public static extern int SetWindowsHookEx(int idHook, HookProc lpfn,
            IntPtr hInstance, int threadId);

        [DllImport("user32.dll", CharSet = CharSet.Auto,
             CallingConvention = CallingConvention.StdCall)]
        public static extern bool UnhookWindowsHookEx(int idHook);

        [DllImport("user32.dll", CharSet = CharSet.Auto,
             CallingConvention = CallingConvention.StdCall)]
        public static extern int CallNextHookEx(int idHook, int nCode,
            Int32 wParam, IntPtr lParam);

        public void Start()
        {
            if (hKeyboardHook == 0)
            {
                KeyboardHookProcedure = new HookProc(KeyboardHookProc);
                hKeyboardHook = SetWindowsHookEx(WH_KEYBOARD_LL,
                    KeyboardHookProcedure,
                    Marshal.GetHINSTANCE(
                    Assembly.GetExecutingAssembly().GetModules()[0]),
                    0);
                if (hKeyboardHook == 0)
                {
                    Stop();
                    throw new Exception();
                }
            }
        }

        public void Stop()
        {
            bool retKeyboard = true;
            if (hKeyboardHook != 0)
            {
                retKeyboard = UnhookWindowsHookEx(hKeyboardHook);
                hKeyboardHook = 0;
            }
            if (!retKeyboard)
            {
                throw new Exception();
            }
        }

        [DllImport("user32")]
        public static extern int ToAscii(
            int uVirtKey, 
            int uScanCode, 
            byte[] lpbKeyState, 
            byte[] lpwTransKey, 
            int fuState);

        [DllImport("user32")]
        public static extern int GetKeyboardState(byte[] pbKeyState);
        private const int WM_KEYDOWN = 0x100;
        private const int WM_KEYUP = 0x101;
        private const int WM_SYSKEYDOWN = 0x104;
        private const int WM_SYSKEYUP = 0x105;

        private int KeyboardHookProc(int nCode, Int32 wParam, IntPtr lParam)
        {
            if ((nCode >= 0) && (KeyDown != null || KeyUp != null || KeyPress != null))
            {
                KeyboardHookStruct MyKeyboardHookStruct = (KeyboardHookStruct)Marshal.PtrToStructure(lParam, typeof(KeyboardHookStruct));
                if (KeyDown != null && (wParam == WM_KEYDOWN || wParam == WM_SYSKEYDOWN))
                {
                    Keys keyData = (Keys)MyKeyboardHookStruct.vkCode;
                    KeyEventArgs e = new KeyEventArgs(keyData);
                    KeyDown(this, e);
                }
                if (KeyPress != null && wParam == WM_KEYDOWN)
                {
                    byte[] keyState = new byte[256];
                    GetKeyboardState(keyState);
                    byte[] inBuffer = new byte[2];
                    if (ToAscii(MyKeyboardHookStruct.vkCode,
                        MyKeyboardHookStruct.scanCode,
                        keyState,
                        inBuffer,
                        MyKeyboardHookStruct.flags) == 1)
                    {
                        KeyPressEventArgs e = new KeyPressEventArgs((char)inBuffer[0]);
                        KeyPress(this, e);
                    }
                }
                if (KeyUp != null && (wParam == WM_KEYUP || wParam == WM_SYSKEYUP))
                {
                    Keys keyData = (Keys)MyKeyboardHookStruct.vkCode;
                    KeyEventArgs e = new KeyEventArgs(keyData);
                    KeyUp(this, e);
                }
            }
            return CallNextHookEx(hKeyboardHook, nCode, wParam, lParam);
        }
    }
}

UserActivityHook.cs --------------------编程问答-------------------- 看着标题进来的…… --------------------编程问答-------------------- alt+f4关闭。 --------------------编程问答-------------------- 很崇拜的进来 --------------------编程问答-------------------- 飘过!~~~~
很无聊的说! --------------------编程问答-------------------- 这个还不如直接写个死循环来关闭显示器. --------------------编程问答-------------------- 谁去试试 --------------------编程问答-------------------- --------------------编程问答-------------------- MouseEnte ??? --------------------编程问答--------------------  private void Form1_MouseEnter(object sender, EventArgs e)
        {
            Form f = new Form();
            f.MouseEnter += new EventHandler(Form1_MouseEnter);
            f.Show();
        }
--------------------编程问答-------------------- ~~~~~~~~~~~~~ --------------------编程问答-------------------- 真是狠啊 --------------------编程问答-------------------- 楼主~~~ 你太强悍了  默哀···· --------------------编程问答-------------------- MouseEnter


使劲打开Windows吧 --------------------编程问答-------------------- 什么东东~~~ --------------------编程问答-------------------- 够撒的 --------------------编程问答--------------------

        private void Form1_Shown(object sender, EventArgs e)
        {
            (new Form1()).Show();
        }
--------------------编程问答-------------------- 接分!
纯粹! --------------------编程问答-------------------- 求烧内存的恶意程序.... --------------------编程问答--------------------
引用 9 楼 tmoonlight 的回复:
引用 7 楼 duanzhanyang 的回复:
是不是鼠标点一下就会不断的弹出窗口?

不是点一下 是鼠标移动到上面就会, 为什么不直接在form load事件里写?

你更毒,佩服 --------------------编程问答-------------------- 不该这样写啊 --------------------编程问答--------------------
引用 4 楼 dogfish 的回复:
是不是不断地打开新的window。

没看出来 --------------------编程问答-------------------- 我无语了,。。。。。。 --------------------编程问答-------------------- 我无语了,。。。。。。 --------------------编程问答-------------------- 我无语了,。。。。。。 --------------------编程问答-------------------- 什么高不懂 --------------------编程问答-------------------- 不如:
while (true) new Form2().Show();

--------------------编程问答-------------------- printf("恶搞"); --------------------编程问答-------------------- 路过看看。。-
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,