当前位置: 首页>>代码示例>>C#>>正文


C# UIntPtr.ToUInt32方法代码示例

本文整理汇总了C#中System.UIntPtr.ToUInt32方法的典型用法代码示例。如果您正苦于以下问题:C# UIntPtr.ToUInt32方法的具体用法?C# UIntPtr.ToUInt32怎么用?C# UIntPtr.ToUInt32使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.UIntPtr的用法示例。


在下文中一共展示了UIntPtr.ToUInt32方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LowLevelKeyboardProc

        private IntPtr LowLevelKeyboardProc(int nCode, UIntPtr wParam, IntPtr lParam)
        {
            if (nCode >= 0)
                if (wParam.ToUInt32() == (int)InterceptKeys.KeyEvent.WM_KEYDOWN ||
                    wParam.ToUInt32() == (int)InterceptKeys.KeyEvent.WM_KEYUP ||
                    wParam.ToUInt32() == (int)InterceptKeys.KeyEvent.WM_SYSKEYDOWN ||
                    wParam.ToUInt32() == (int)InterceptKeys.KeyEvent.WM_SYSKEYUP)
                    _hookedKeyboardCallbackAsync.BeginInvoke((InterceptKeys.KeyEvent)wParam.ToUInt32(), Marshal.ReadInt32(lParam), null, null);

            return InterceptKeys.CallNextHookEx(_hookId, nCode, wParam, lParam);
        }
开发者ID:WELL-E,项目名称:Hurricane,代码行数:11,代码来源:Keyboard.cs

示例2: ToStatus

        public static StatusMode ToStatus(UIntPtr wParam)
        {
            if (!Enum.IsDefined(StatusEnumType, (int)wParam.ToUInt32()))
                throw new ArgumentException("wParam", TextResources.ExceptionMsg_InvalidValueToTranslate);

            return (StatusMode)(wParam);
        }
开发者ID:tomasdeml,项目名称:hyphen,代码行数:7,代码来源:Translate.cs

示例3: KeyboardHook

 public static UIntPtr KeyboardHook(int nCode, UIntPtr wParam, IntPtr lParam)
 {
     try
     {
         if (nCode == 0)
         {
             var wm = (WinAPI.WM)wParam.ToUInt32();
             Mubox.WinAPI.WindowHook.KBDLLHOOKSTRUCT keyboardHookStruct = (Mubox.WinAPI.WindowHook.KBDLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(Mubox.WinAPI.WindowHook.KBDLLHOOKSTRUCT));
             if (OnKeyboardInputReceived(wm, keyboardHookStruct))
             {
                 return new UIntPtr(1);
             }
         }
     }
     catch (Exception ex)
     {
         ex.Log();
     }
     try
     {
         return Mubox.WinAPI.WindowHook.CallNextHookEx(hHook, nCode, wParam, lParam);
     }
     catch (Exception ex)
     {
         ex.Log();
     }
     return new UIntPtr(1);
 }
开发者ID:wilson0x4d,项目名称:Mubox,代码行数:28,代码来源:KeyboardInputHook.cs

示例4: HookCallback

		/// <include file='ManagedHooks.xml' path='Docs/KeyboardHook/HookCallback/*'/>
		protected override void HookCallback(int code, UIntPtr wparam, IntPtr lparam)
		{
            if (KeyboardEvent == null)
			{
				return;
			}

			int vkCode = 0;
			KeyboardEvents kEvent = (KeyboardEvents)wparam.ToUInt32();

			if (kEvent != KeyboardEvents.KeyDown		&&
				kEvent != KeyboardEvents.KeyUp			&&
				kEvent != KeyboardEvents.SystemKeyDown	&&
				kEvent != KeyboardEvents.SystemKeyUp)
			{
				return;
			}

			GetKeyboardReading(wparam, lparam, ref vkCode);
			VirtualKeys vk = (VirtualKeys)vkCode;
				
			System.Windows.Forms.Keys key  = ConvertKeyCode(vk);

			if (key == System.Windows.Forms.Keys.Attn)
			{
				return;
			}

			KeyboardEvent(kEvent, key);
		}
开发者ID:Season02,项目名称:MK2.0,代码行数:31,代码来源:KeyboardHook.cs

示例5: LowLevelKeyboardProc

        private IntPtr LowLevelKeyboardProc(int nCode, UIntPtr wParam, IntPtr lParam)
        {
            bool continues = true;

            if (nCode >= 0)
            {
                if (wParam.ToUInt32() == (int)KeyEvent.WM_KEYDOWN ||
                    wParam.ToUInt32() == (int)KeyEvent.WM_KEYUP ||
                    wParam.ToUInt32() == (int)KeyEvent.WM_SYSKEYDOWN ||
                    wParam.ToUInt32() == (int)KeyEvent.WM_SYSKEYUP)
                {
                    if (hookedKeyboardCallback != null)
                        continues = hookedKeyboardCallback((KeyEvent)wParam.ToUInt32(), Marshal.ReadInt32(lParam), CheckModifiers());
                }
            }

            if (continues)
            {
                return InterceptKeys.CallNextHookEx(hookId, nCode, wParam, lParam);
            }
            return (IntPtr)1;
        }
开发者ID:dylandee,项目名称:Wox,代码行数:22,代码来源:GlobalHotkey.cs

示例6: InternalOnDataReceived

        internal static void InternalOnDataReceived(
            IntPtr room, IntPtr participant, IntPtr data, UIntPtr dataLength, bool isReliable,
            IntPtr userData)
        {
            GooglePlayGames.OurUtils.Logger.d("Entering InternalOnDataReceived: " + userData.ToInt64());

            var callback = Callbacks.IntPtrToPermanentCallback
            <Action<NativeRealTimeRoom, MultiplayerParticipant, byte[], bool>>(userData);

            using (var nativeRoom = NativeRealTimeRoom.FromPointer(room))
            {
                using (var nativeParticipant = MultiplayerParticipant.FromPointer(participant))
                {
                    if (callback == null)
                    {
                        return;
                    }

                    byte[] convertedData = null;

                    if (dataLength.ToUInt64() != 0)
                    {
                        convertedData = new byte[dataLength.ToUInt32()];
                        Marshal.Copy(data, convertedData, 0, (int)dataLength.ToUInt32());
                    }

                    try
                    {
                        callback(nativeRoom, nativeParticipant, convertedData, isReliable);
                    }
                    catch (Exception e)
                    {
                        GooglePlayGames.OurUtils.Logger.e("Error encountered executing InternalOnDataReceived. " +
                            "Smothering to avoid passing exception into Native: " + e);
                    }
                }
            }
        }
开发者ID:Astharoshe,项目名称:Repository,代码行数:38,代码来源:RealTimeEventListenerHelper.cs

示例7: LowLevelKeyboardProc

        private IntPtr LowLevelKeyboardProc(int nCode, UIntPtr wParam, IntPtr lParam)
        {
            string chars = "";

            if (nCode >= 0)
                if (wParam.ToUInt32() == (int)InterceptKeys.KeyEvent.WM_KEYDOWN ||
                    wParam.ToUInt32() == (int)InterceptKeys.KeyEvent.WM_KEYUP ||
                    wParam.ToUInt32() == (int)InterceptKeys.KeyEvent.WM_SYSKEYDOWN ||
                    wParam.ToUInt32() == (int)InterceptKeys.KeyEvent.WM_SYSKEYUP)
                {
                    // Captures the character(s) pressed only on WM_KEYDOWN
                    chars = InterceptKeys.VKCodeToString((uint)Marshal.ReadInt32(lParam),
                        (wParam.ToUInt32() == (int)InterceptKeys.KeyEvent.WM_KEYDOWN ||
                        wParam.ToUInt32() == (int)InterceptKeys.KeyEvent.WM_SYSKEYDOWN));

                    hookedKeyboardCallbackAsync.BeginInvoke((InterceptKeys.KeyEvent)wParam.ToUInt32(), Marshal.ReadInt32(lParam), chars, null, null);
                }

            return InterceptKeys.CallNextHookEx(hookId, nCode, wParam, lParam);
        }
开发者ID:nijunjie,项目名称:UITextTransRepo,代码行数:20,代码来源:Keyboard.cs

示例8: GetCommandString

 public void GetCommandString(
     UIntPtr idCmd,
     uint uFlags,
     IntPtr pReserved,
     StringBuilder pszName,
     uint cchMax)
 {
     int index = Convert.ToInt32(idCmd.ToUInt32());
     String[] texts = Constants.getLabels(currentActionDispacher.CurrentActions[index]);
     // To change
     switch ((GCS)uFlags)
     {
         case GCS.VERBW:
             pszName.Clear();
             pszName.Append(texts[1]);
             break;
         case GCS.HELPTEXTW:
             pszName.Clear();
             pszName.Append(texts[2]);
             break;
     }
 }
开发者ID:nuxeo,项目名称:nuxeo-otg-win,代码行数:22,代码来源:ContextMenuExt.cs

示例9: MouseHook

 public static UIntPtr MouseHook(int nCode, UIntPtr wParam, IntPtr lParam)
 {
     try
     {
         if (nCode == 0)
         {
             var wm = (WinAPI.WM)wParam.ToUInt32();
             if (wm == WinAPI.WM.MOUSEMOVE)
             {
                 if (DateTime.Now.Ticks <= _nextMouseMoveAccept)
                 {
                     // a.k.a not handled
                     return Mubox.WinAPI.WindowHook.CallNextHookEx(hHook, nCode, wParam, lParam);
                 }
                 _nextMouseMoveAccept = DateTime.Now.AddMilliseconds(50).Ticks; // 20fps - we limit this to ease off of network and cpu utilization for mousemove, the framerate choice here is arbitrary
             }
             Mubox.WinAPI.WindowHook.MSLLHOOKSTRUCT mouseHookStruct = (Mubox.WinAPI.WindowHook.MSLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(Mubox.WinAPI.WindowHook.MSLLHOOKSTRUCT));
             if (OnMouseInputReceived(wm, mouseHookStruct))
             {
                 return new UIntPtr(1); // handled
             }
         }
     }
     catch (Exception ex)
     {
         ex.Log();
     }
     try
     {
         return Mubox.WinAPI.WindowHook.CallNextHookEx(hHook, nCode, wParam, lParam);
     }
     catch (Exception ex)
     {
         ex.Log();
     }
     return UIntPtr.Zero;
 }
开发者ID:wilson0x4d,项目名称:Mubox,代码行数:37,代码来源:MouseInputHook.cs

示例10: HookCallback

		/// <include file='ManagedHooks.xml' path='Docs/MouseHook/HookCallback/*'/>
		protected override void HookCallback(int code, UIntPtr wparam, IntPtr lparam)
		{
			if (MouseEvent == null)
			{
				return;
			}

			int x = 0, y = 0;
			MouseEvents mEvent = (MouseEvents)wparam.ToUInt32();

			switch(mEvent)
			{
				case MouseEvents.LeftButtonDown:
					GetMousePosition(wparam, lparam, ref x, ref y);
					break;
				case MouseEvents.LeftButtonUp:
					GetMousePosition(wparam, lparam, ref x, ref y);
					break;
				case MouseEvents.MouseWheel:
					break;
				case MouseEvents.Move:
					GetMousePosition(wparam, lparam, ref x, ref y);
					break;
				case MouseEvents.RightButtonDown:
					GetMousePosition(wparam, lparam, ref x, ref y);
					break;
				case MouseEvents.RightButtonUp:
					GetMousePosition(wparam, lparam, ref x, ref y);
					break;
				default:
					//System.Diagnostics.Trace.WriteLine("Unrecognized mouse event");
					break;
			}

			MouseEvent(mEvent, new Point(x, y));
		}
开发者ID:Season02,项目名称:MK2.0,代码行数:37,代码来源:MouseHook.cs

示例11: LowLevelKeyboardProc

        private IntPtr LowLevelKeyboardProc(int nCode, UIntPtr wParam, IntPtr lParam)
        {
            bool block = false;

            if (nCode >= 0)
            {
                if (wParam.ToUInt32() == (int)KeyEvent.WM_KEYDOWN ||
                    wParam.ToUInt32() == (int)KeyEvent.WM_KEYUP ||
                    wParam.ToUInt32() == (int)KeyEvent.WM_SYSKEYDOWN ||
                    wParam.ToUInt32() == (int)KeyEvent.WM_SYSKEYUP)
                {
                    _hookedKeyboardCallback((KeyEvent)wParam.ToUInt32(), Marshal.ReadInt32(lParam), ref block);
                }
            }

            if (block)
            {
                return new IntPtr(-1);
            }

            return CallNextHookEx(_hookId, nCode, wParam, lParam);
        }
开发者ID:Zargess,项目名称:Shapeshifter-old,代码行数:22,代码来源:KeyboardListener.cs

示例12: LowLevelKeyboardProc

        private IntPtr LowLevelKeyboardProc(int nCode, UIntPtr wParam, IntPtr lParam)
        {
            /* TODO: Change BeginInvoke to Invoke to block windows from handling things like the start key */
                if (nCode >= 0)
                    if (wParam.ToUInt32() == (int)InterceptKeys.KeyEvent.WM_KEYDOWN ||
                        wParam.ToUInt32() == (int)InterceptKeys.KeyEvent.WM_KEYUP ||
                        wParam.ToUInt32() == (int)InterceptKeys.KeyEvent.WM_SYSKEYDOWN ||
                        wParam.ToUInt32() == (int)InterceptKeys.KeyEvent.WM_SYSKEYUP)
                        hookedKeyboardCallbackAsync.BeginInvoke((InterceptKeys.KeyEvent)wParam.ToUInt32(), Marshal.ReadInt32(lParam), null, null);

                return InterceptKeys.CallNextHookEx(hookId, nCode, wParam, lParam);
        }
开发者ID:zschallz,项目名称:BabyDazzler,代码行数:12,代码来源:KeyboardListener.cs

示例13: Write

 /// <summary>
 /// Write
 /// </summary>
 /// <param name="dataBuffer">Data buffer</param>
 /// <param name="numBytesToWrite">Number bytes to write</param>
 /// <param name="numBytesWritten">Number bytes written</param>
 /// <returns>A <see cref="FT_STATUS"/></returns>
 public FT_STATUS Write(byte[] dataBuffer, int numBytesToWrite, ref uint numBytesWritten)
 {
     FT_STATUS status = FT_STATUS.FT_OTHER_ERROR;
     UIntPtr written = new UIntPtr(0);
     try { status = FT_Write(_currentHandle, dataBuffer, numBytesToWrite, out written); } catch { }
     numBytesWritten = written.ToUInt32();
     return status;
 }
开发者ID:karnauhov,项目名称:smart-h,代码行数:15,代码来源:WinFTDI.cs

示例14: SetWindowLongPtr

		public static IntPtr SetWindowLongPtr (HandleRef hWnd, int nIndex, UIntPtr dwNewLong) {
			if (IntPtr.Size == 8)
				return SetWindowLongPtr64(hWnd, nIndex, dwNewLong);
			else
				return new IntPtr(SetWindowLong32(hWnd, nIndex, dwNewLong.ToUInt32()));
		}
开发者ID:Alex-Butenko,项目名称:HwndHostControl,代码行数:6,代码来源:WinAPI.cs

示例15: Refresh

        public void Refresh()
        {
            StringBuilder sb = new StringBuilder();

            // get caption
            sb.EnsureCapacity(10240);

            bool WindowTimedOut = false;

            UIntPtr lRes = new UIntPtr(1860);
            int lResult = SendMessageTimeout(Handle, WM_GETTEXT, 10240, sb, SMTO_ABORTIFHUNG, 1000, out lRes);
            if (lResult == 0)
            {
                Trace.TraceError("SendMessageTimeout() failed with {0}", Marshal.GetLastWin32Error());
                WindowTimedOut = true;
                Objects[(int)WindowItemTypes.Title] = "?";
            }
            else
            {
                //Trace.TraceInformation("lResult: {0}, lRes: {1}", lResult, lRes.ToUInt32());
                Objects[(int)WindowItemTypes.Title] = sb.ToString();
            }

            // get class name
            sb = new StringBuilder();
            sb.EnsureCapacity(10240);
            GetClassName(Handle, sb, 10240);
            Objects[(int)WindowItemTypes.Class] = sb.ToString();

            uint style = GetWindowLong(Handle, GWL_STYLE);
            Objects[(int)WindowItemTypes.Style] = DecodeWindowStyle(style);
            Objects[(int)WindowItemTypes.ExStyle] = GetWindowLong(Handle, GWL_EXSTYLE);
            Objects[(int)WindowItemTypes.ID] = GetWindowLong(Handle, GWL_ID);

            RECT r = new RECT();
            GetWindowRect(Handle, ref r);

            Objects[(int)WindowItemTypes.Size] = string.Format("({0}, {1})", r.Width, r.Height);
            Objects[(int)WindowItemTypes.Position] = string.Format("({0}, {1})", r.Top, r.Left);

            UIntPtr ProcessID = new UIntPtr(0);
            uint ThreadID = GetWindowThreadProcessId(Handle, out ProcessID);
            Objects[(int)WindowItemTypes.TID] = ThreadID;
            Objects[(int)WindowItemTypes.PID] = ProcessID.ToUInt32();

            ForegroundColor = Color.Black;
            if ((r.Width == r.Height) && (r.Width == 0))
            {
                ForegroundColor = Color.Gray;
            }
            if ((style & WS_VISIBLE) == 0)
            {
                ForegroundColor = Color.Gray;
            }
            if (WindowTimedOut)
            {
                ForegroundColor = Color.Red;
            }
        }
开发者ID:k4gdw,项目名称:GSharpTools,代码行数:59,代码来源:WindowObject.cs


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