zoukankan      html  css  js  c++  java
  • 给窗体的任务栏右键菜单增加项目

    给窗体的任务栏右键菜单增加项目
            [DllImport("user32.dll")]
            private static extern int GetSystemMenu(int hwnd, int bRevert);
            [DllImport("user32.dll")]
            private static extern int AppendMenu(int hMenu, int Flagsw, int IDNewItem, string lpNewItem);
                //   get   handle   to   system   menu  
                int menu = GetSystemMenu(this.Handle.ToInt32(), 0);
                //   add   a   separator  
                AppendMenu(menu, 0xA00, 0, null);
                //   add   an   item   with   a   unique   ID  
                AppendMenu(menu, 0, 1234, "跳至URL");
                AppendMenu(menu, 0, 1235, "关于HTML帮助");

    处理事件
            protected override void WndProc(ref Message m)
            {
                base.WndProc(ref   m);
                //   WM_SYSCOMMAND   is   0x112  
                if (m.Msg == 0x112)
                {
                    //   check   for   my   new   menu   item   ID  
                    if (m.WParam.ToInt32() == 1234)
                    {
                        //   show   About   box   here  
                        MessageBox.Show("Btn One");
                    }
                    if (m.WParam.ToInt32() == 1235)
                    {
                        //   show   About   box   here  
                        MessageBox.Show("Btn Two");
                    }
                }
            }
  • 相关阅读:
    SGU 495 Kids and Prizes 概率DP 或 数学推理
    poj 2799 IP Networks 模拟 位运算
    uva 202 Repeating Decimals 模拟
    poj 3158 Kickdown 字符串匹配?
    uva 1595 Symmetry 暴力
    uva 201 Squares 暴力
    uva 1594 Ducci Sequence 哈希
    uva 1368 DNA Consensus String 字符串
    数字、字符串、列表的常用操作
    if条件判断 流程控制
  • 原文地址:https://www.cnblogs.com/linmilove/p/1500877.html
Copyright © 2011-2022 走看看