• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# WindowMessage类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中WindowMessage的典型用法代码示例。如果您正苦于以下问题:C# WindowMessage类的具体用法?C# WindowMessage怎么用?C# WindowMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



WindowMessage类属于命名空间,在下文中一共展示了WindowMessage类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ApplicationMessageBinding

 /// <summary>
 /// Обычный конструктор
 /// </summary>
 public ApplicationMessageBinding(ApplicationMessage message, Keys mainKey, WindowMessage messageType)
 {
     Message = message;
     Title = EnumFriendlyName<ApplicationMessage>.GetString(message);
     this.mainKey = mainKey;
     this.messageType = messageType;
 }
开发者ID:johnmensen,项目名称:TradeSharp,代码行数:10,代码来源:AppMessageFilter.cs


示例2: FilterMessage

        internal IntPtr FilterMessage( IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, ref bool handled )
        {
            // It is possible to be re-entered during disposal.  Just return.
            if(null == _source || null == _source.Value)
            {
                return IntPtr.Zero;
            }
            
            if (msg == WindowMessage.WM_APPCOMMAND)
            {
                // WM_APPCOMMAND message notifies a window that the user generated an application command event,
                // for example, by clicking an application command button using the mouse or typing an application command
                // key on the keyboard.
                RawAppCommandInputReport report = new RawAppCommandInputReport(
                                                        _source.Value,
                                                        InputMode.Foreground,
                                                        SafeNativeMethods.GetMessageTime(),
                                                        GetAppCommand(lParam),
                                                        GetDevice(lParam),
                                                        InputType.Command);

                handled = _site.Value.ReportInput(report);
            }
            
            return handled ? new IntPtr(1) : IntPtr.Zero ;
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:26,代码来源:HwndAppCommandInputProvider.cs


示例3: SendWindowMsg

 public override void SendWindowMsg(WindowMessage msg, params object[] args)
 {
     base.SendWindowMsg(msg, args);
     switch (msg) {
         case WindowMessage.eWindow_BeAttacked:
             //受击者被攻击
             BattleRoleItem script = this.BeAttackedRoleGo.GetComponent<BattleRoleItem>();
             script.SetBeAttackTargetPos((Vector3)args[0]);
             script.BeAttackedStart();
             break;
         case WindowMessage.eWindow_BattleStart:
             SetAttackBothSide((RoleType)args[0]);
             BattleStart();
             break;
         case WindowMessage.eWindow_CurRoundOver:
             BeforeNextRound();
             if (BattleMgr.Instance.IsBattleOver()) {
                 BattleMgr.Instance.CurBattleStatus = BattleStatus.Invalid;
                 return;
             }
             BattleMgr.Instance.bStartRun = true;   //本轮攻击结束,开始跑速
             break;
         default:
             break;
     }
 }
开发者ID:JudyPhy,项目名称:JudyPhy-Project,代码行数:26,代码来源:UIBattle.cs


示例4: Initialize

 public void Initialize()
 {
     var window = new WindowMessage(Text);
     ManagerWindow.NewWindow("gameEventMessage",window);
     ManagerInput.ThrottleInput = true;
     Done = false;
 }
开发者ID:Bribz,项目名称:SpeedCodingZelda,代码行数:7,代码来源:GameEventMessage.cs


示例5: RegisterWindowMessageHandler

        public bool RegisterWindowMessageHandler(WindowMessage callback)
        {
            bool result = true;
            if (null == callback)
            {
                throw FxTrace.Exception.AsError(new ArgumentNullException("callback"));
            }

            //if there are no other callbacks registered - create initial multicast delegate 
            //and hookup message processing
            if (null == this.listeners)
            {
                this.listeners = (WindowMessage)Delegate.Combine(callback);
                this.HookupMessageProcessing();
            }
                //otherwise, check if callback is not in the list already
            else 
            {
                Delegate[] initial = this.listeners.GetInvocationList();
                //if it isn't - add it to callback list
                if (-1 == Array.IndexOf<Delegate>(initial, callback))
                {
                    Delegate[] combined = new Delegate[initial.Length + 1];
                    combined[initial.Length] = callback;
                    Array.Copy(initial, combined, initial.Length);

                    this.listeners = (WindowMessage)Delegate.Combine(combined);
                }
                else
                {
                    result = false;
                }
            }
            return result;
        }
开发者ID:uQr,项目名称:referencesource,代码行数:35,代码来源:WindowHelperService.cs


示例6: DialogProc

        protected override bool DialogProc(IntPtr hwndDlg, WindowMessage uMsg, IntPtr wParam, IntPtr lParam)
        {
            switch (uMsg)
            {
                case WindowMessage.InitDialog:
                    {
                        Rect initialSize = new Rect
                        {
                            Left = 0,
                            Top = 0,
                            Right = 260,
                            Bottom = 260
                        };

                        Win32.MapDialogRect(hwndDlg, ref initialSize);

                        this.Size = new System.Drawing.Size(initialSize.Right, initialSize.Bottom);

                        this.Refresh();
                    }
                    break;
            }

            return base.DialogProc(hwndDlg, uMsg, wParam, lParam);
        }
开发者ID:john-peterson,项目名称:processhacker,代码行数:25,代码来源:ProcessPropertySheetPage.cs


示例7: GetKeyboardKeyAction

 internal KeyboardKeyAction GetKeyboardKeyAction(WindowMessage message)
 {
     KeyboardKeyAction action;
     if (!_mappings.WindowMessageToKeyboardKeyAction.TryGetValue(message, out action))
     {
         action = KeyboardKeyAction.None;
     }
     return action;
 }
开发者ID:kavengagne,项目名称:WinApiWrapper,代码行数:9,代码来源:KeyboardMessagesTranslator.cs


示例8: SendWindowMsg

 public void SendWindowMsg(WindowID targetWindow, WindowMessage msg, params object[] args)
 {
     if (!AllWindowScript.ContainsKey(targetWindow)) {
         return;
     }
     if (!AllWindowScript[targetWindow]) {
         return;
     }
     AllWindowScript[targetWindow].SendWindowMsg(msg, args);
 }
开发者ID:JudyPhy,项目名称:JudyPhy-Project,代码行数:10,代码来源:UIManager.cs


示例9: DialogProc

        protected override unsafe bool DialogProc(IntPtr hwndDlg, WindowMessage uMsg, IntPtr wParam, IntPtr lParam)
        {
            switch (uMsg)
            {
                case WindowMessage.InitDialog:
                    {
                        Rect initialSize;

                        initialSize.left = 0;
                        initialSize.top = 0;
                        initialSize.right = 260;
                        initialSize.bottom = 260;
                        NativeApi.MapDialogRect(hwndDlg, ref initialSize);
                        this.Size = new System.Drawing.Size(initialSize.right, initialSize.bottom);
                    }
                    break;
                case WindowMessage.ShowWindow:
                    if (!_layoutInitialized)
                    {
                        void* dialogItem = NativeApi.PhAddPropPageLayoutItem(
                            hwndDlg,
                            hwndDlg,
                            (void*)0x1, // PH_PROP_PAGE_TAB_CONTROL_PARENT
                            0xf // PH_ANCHOR_ALL
                            );

                        // Resize our .NET-based control automatically as well.
                        NativeApi.PhAddPropPageLayoutItem(
                            hwndDlg,
                            this.Handle,
                            dialogItem,
                            0xf // PH_ANCHOR_ALL
                            );

                        NativeApi.PhDoPropPageLayout(hwndDlg);

                        _layoutInitialized = true;
                    }
                    break;
            }

            return base.DialogProc(hwndDlg, uMsg, wParam, lParam);
        }
开发者ID:john-peterson,项目名称:processhacker,代码行数:43,代码来源:ProcessPropertySheetPage.cs


示例10: ScrollToBottom

 public static Boolean ScrollToBottom(IntPtr Handle, Boolean Blocking)
 {
     WindowMessage Message = new WindowMessage();
     Message.Handle = Handle;
     Message.InVal = KEYWORDS.WM_VSCROLL;
     Message.PtrLparam = new IntPtr(0);
     Message.PtrWparam = KEYWORDS.SB_BOTTOM;
     if (Blocking)
     {
         return System.Boolean.Equals(true, SendWindowMessage(Message));
     }
     else
     {
         ParameterizedThreadStart pts = new ParameterizedThreadStart(SendWindowMessage);
         Thread t = new Thread(pts);
         t.Start(Message);
         return false;
     }
 }
开发者ID:Sajaki,项目名称:uniuploader,代码行数:19,代码来源:Windows.cs


示例11: HandleXButtonDown

 void HandleXButtonDown(IntPtr handle, WindowMessage message, IntPtr wParam, IntPtr lParam)
 {
     Functions.SetCapture(window.Handle);
     mouse[((wParam.ToInt32() & 0xFFFF0000) >> 16) == 1 ?
         MouseButton.Button1 : MouseButton.Button2] = true;
 }
开发者ID:raphaelts3,项目名称:opentk,代码行数:6,代码来源:WinGLNative.cs


示例12: HandleRButtonDown

 void HandleRButtonDown(IntPtr handle, WindowMessage message, IntPtr wParam, IntPtr lParam)
 {
     Functions.SetCapture(window.Handle);
     mouse[MouseButton.Right] = true;
 }
开发者ID:raphaelts3,项目名称:opentk,代码行数:5,代码来源:WinGLNative.cs


示例13: ProcessMouseMessage

		/// <summary>
		/// Filters out a mouse message before it is dispatched
		/// </summary>
		/// <param name="target">The Control that will receive the message</param>
		/// <param name="msg">A WindowMessage that represents the message to process</param>
		/// <param name="wParam">Specifies the WParam field of the message</param>
		/// <param name="lParam">Specifies the LParam field of the message</param>
		/// <returns>true to filter the message and prevent it from being dispatched; 
		/// false to allow the message to continue to the next filter or control</returns>
		public override bool ProcessMouseMessage(Control target, WindowMessage msg, int wParam, int lParam)
		{
			if (this.DroppedDown)
			{
				if (msg == WindowMessage.WM_LBUTTONDOWN || msg == WindowMessage.WM_RBUTTONDOWN || 
					msg == WindowMessage.WM_MBUTTONDOWN || msg == WindowMessage.WM_XBUTTONDOWN || 
					msg == WindowMessage.WM_NCLBUTTONDOWN || msg == WindowMessage.WM_NCRBUTTONDOWN || 
					msg == WindowMessage.WM_NCMBUTTONDOWN || msg == WindowMessage.WM_NCXBUTTONDOWN)
				{	
					Point cursorPos = Cursor.Position;
				
					if (!this.DropDown.Bounds.Contains(cursorPos))
					{
						if (target != this.EditingTable && target != this.TextBox)
						{
							if (this.ShouldStopEditing(target, cursorPos))
							{
								this.EditingTable.StopEditing();
							}
						}
					}
				}
				else if (msg == WindowMessage.WM_MOUSEMOVE)
				{
					Point cursorPos = Cursor.Position;
				
					if (this.DropDown.Bounds.Contains(cursorPos))
					{
						if (!this.containsMouse)
						{
							this.containsMouse = true;

							this.EditingTable.RaiseCellMouseLeave(this.EditingCellPos);
						}
					}
					else
					{
						this.containsMouse = true;
					}
				}
			}
			
			return false;
		}
开发者ID:nithinphilips,项目名称:SMOz,代码行数:53,代码来源:DropDownCellEditor.cs


示例14: WindowProcedure

 protected override IntPtr WindowProcedure(IntPtr handle, WindowMessage message, IntPtr wParam, IntPtr lParam)
 {
     switch (message)
       {
     case WindowMessage.INPUT:
       int Size = 0;
       Functions.GetRawInputData(lParam, GetRawInputDataEnum.INPUT, IntPtr.Zero, out Size, API.RawInputHeaderSize);
       if (Size == Functions.GetRawInputData(lParam, GetRawInputDataEnum.INPUT, out WinRawInput.data, out Size, API.RawInputHeaderSize))
       {
     switch (WinRawInput.data.Header.Type)
     {
       case RawInputDeviceType.MOUSE:
         if (((WinRawMouse) this.MouseDriver).ProcessMouseEvent(WinRawInput.data))
           return IntPtr.Zero;
         else
           break;
       case RawInputDeviceType.KEYBOARD:
         if (((WinRawKeyboard) this.KeyboardDriver).ProcessKeyboardEvent(WinRawInput.data))
           return IntPtr.Zero;
         else
           break;
     }
       }
       else
     break;
     case WindowMessage.DEVICECHANGE:
       ((WinRawKeyboard) this.KeyboardDriver).RefreshDevices();
       ((WinRawMouse) this.MouseDriver).RefreshDevices();
       break;
       }
       return base.WindowProcedure(handle, message, wParam, lParam);
 }
开发者ID:Zeludon,项目名称:FEZ,代码行数:32,代码来源:WinRawInput.cs


示例15: HandleDestroy

        void HandleDestroy(IntPtr handle, WindowMessage message, IntPtr wParam, IntPtr lParam)
        {
            exists = false;

            if (handle == window.Handle)
            {
                Functions.UnregisterClass(ClassName, Instance);
            }
            window.Dispose();
            child_window.Dispose();

            Closed(this, EventArgs.Empty);
        }
开发者ID:raphaelts3,项目名称:opentk,代码行数:13,代码来源:WinGLNative.cs


示例16: HandleCreate

        void HandleCreate(IntPtr handle, WindowMessage message, IntPtr wParam, IntPtr lParam)
        {
            CreateStruct cs = (CreateStruct)Marshal.PtrToStructure(lParam, typeof(CreateStruct));
            if (cs.hwndParent == IntPtr.Zero)
            {
                bounds.X = cs.x;
                bounds.Y = cs.y;
                bounds.Width = cs.cx;
                bounds.Height = cs.cy;

                Win32Rectangle rect;
                Functions.GetClientRect(handle, out rect);
                client_rectangle = rect.ToRectangle();

                invisible_since_creation = true;
            }
        }
开发者ID:raphaelts3,项目名称:opentk,代码行数:17,代码来源:WinGLNative.cs


示例17: HandleKeyboard

        void HandleKeyboard(IntPtr handle, WindowMessage message, IntPtr wParam, IntPtr lParam)
        {
            bool pressed =
                message == WindowMessage.KEYDOWN ||
                message == WindowMessage.SYSKEYDOWN;

            // Shift/Control/Alt behave strangely when e.g. ShiftRight is held down and ShiftLeft is pressed
            // and released. It looks like neither key is released in this case, or that the wrong key is
            // released in the case of Control and Alt.
            // To combat this, we are going to release both keys when either is released. Hacky, but should work.
            // Win95 does not distinguish left/right key constants (GetAsyncKeyState returns 0).
            // In this case, both keys will be reported as pressed.

            bool extended = (lParam.ToInt64() & ExtendedBit) != 0;
            short scancode = (short)((lParam.ToInt64() >> 16) & 0xFF);
            VirtualKeys vkey = (VirtualKeys)wParam;
            bool is_valid;
            Key key = KeyMap.TranslateKey(scancode, vkey, extended, false, out is_valid);

            if (is_valid)
            {
                keyboard.SetKey(key, (byte)scancode, pressed);

                if (pressed)
                {
                    key_down.Key = key;
                    key_down.Modifiers = keyboard.GetModifiers();
                    KeyDown(this, key_down);
                }
                else
                {
                    key_up.Key = key;
                    key_up.Modifiers = keyboard.GetModifiers();
                    KeyUp(this, key_up);
                }
            }
        }
开发者ID:raphaelts3,项目名称:opentk,代码行数:37,代码来源:WinGLNative.cs


示例18: HandleRButtonUp

 void HandleRButtonUp(IntPtr handle, WindowMessage message, IntPtr wParam, IntPtr lParam)
 {
     Functions.ReleaseCapture();
     mouse[MouseButton.Right] = false;
 }
开发者ID:raphaelts3,项目名称:opentk,代码行数:5,代码来源:WinGLNative.cs


示例19: HandleXButtonUp

 void HandleXButtonUp(IntPtr handle, WindowMessage message, IntPtr wParam, IntPtr lParam)
 {
     Functions.ReleaseCapture();
     mouse[((wParam.ToInt32() & 0xFFFF0000) >> 16) == 1 ?
         MouseButton.Button1 : MouseButton.Button2] = false;
 }
开发者ID:raphaelts3,项目名称:opentk,代码行数:6,代码来源:WinGLNative.cs


示例20: HandleStyleChanged

        void HandleStyleChanged(IntPtr handle, WindowMessage message, IntPtr wParam, IntPtr lParam)
        {
            WindowBorder old_border = windowBorder;
            WindowBorder new_border = old_border;

            unsafe
            {
                GWL get_window_style = (GWL)unchecked(wParam.ToInt32());
                if ((get_window_style & (GWL.STYLE | GWL.EXSTYLE)) != 0)
                {
                    WindowStyle style = ((StyleStruct*)lParam)->New;
                    if ((style & WindowStyle.Popup) != 0)
                        new_border = WindowBorder.Hidden;
                    else if ((style & WindowStyle.ThickFrame) != 0)
                        new_border = WindowBorder.Resizable;
                    else if ((style & ~(WindowStyle.ThickFrame | WindowStyle.MaximizeBox)) != 0)
                        new_border = WindowBorder.Fixed;
                }
            }

            if (new_border != windowBorder)
            {
                // Ensure cursor remains grabbed
                if (!CursorVisible)
                    GrabCursor();

                windowBorder = new_border;
                WindowBorderChanged(this, EventArgs.Empty);
            }
        }
开发者ID:raphaelts3,项目名称:opentk,代码行数:30,代码来源:WinGLNative.cs



注:本文中的WindowMessage类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# WindowMode类代码示例发布时间:2022-05-24
下一篇:
C# WindowFrameShowAction类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap