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


C# IntPtr.ToInt32方法代码示例

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


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

示例1: SetWindowLongPtr

 // This static method is required because legacy OSes do not support
 // SetWindowLongPtr
 internal static IntPtr SetWindowLongPtr(HandleRef hWnd, int nIndex, IntPtr dwNewLong)
 {
     if (IntPtr.Size == 8)
         return SetWindowLongPtr64(hWnd, nIndex, dwNewLong);
     else
         return new IntPtr(SetWindowLong32(hWnd, nIndex, dwNewLong.ToInt32()));
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:9,代码来源:Win32Interop.cs

示例2: Main

        public Main( RemoteHooking.IContext InContext, string serverName )
        {
            mySendClientQueue = new Queue<Packet>();
            mySendClientLock = new object();
            mySendServerQueue = new Queue<Packet>();
            mySendServerLock = new object();
            myRecvFilter = new bool[256];
            mySendFilter = new bool[256];
            myRecvDelegate = new dSendRecv( ReceiveHook );
            mySendDelegate = new dSendRecv( SendHook );
            myPID = RemoteHooking.GetCurrentProcessId();
            myThreadID = RemoteHooking.GetCurrentThreadId();
            myDateStamp = GetDateStamp();
            myServerSendBuffer = Marshal.AllocHGlobal( 65536 );
            myClientSendBuffer = Marshal.AllocHGlobal( 65536 );
            myServerBufferAddress = BitConverter.GetBytes( myServerSendBuffer.ToInt32() );
            myClientBufferAddress = BitConverter.GetBytes( myClientSendBuffer.ToInt32() );

            myClientInstance = new ClientInstance( serverName, true );
            myClientInstance.SendCommand( Command.ClientID, myPID );
            myClientInstance.SendPacketEvent += new dSendPacket( myClientInstance_sendPacketEvent );
            myClientInstance.PingEvent += new dPing( myClientInstance_pingEvent );
            myClientInstance.AddRecvFilterEvent += new dAddRecvFilter( myClientInstance_addRecvFilterEvent );
            myClientInstance.AddSendFilterEvent += new dAddSendFilter( myClientInstance_addSendFilterEvent );
            myClientInstance.RemoveRecvFilterEvent += new dRemoveRecvFilter( myClientInstance_removeRecvFilterEvent );
            myClientInstance.RemoveSendFilterEvent += new dRemoveSendFilter( myClientInstance_removeSendFilterEvent );
            myClientInstance.ClearRecvFilterEvent += new dClearRecvFilter( myClientInstance_clearRecvFilterEvent );
            myClientInstance.ClearSendFilterEvent += new dClearSendFilter( myClientInstance_clearSendFilterEvent );
        }
开发者ID:FreeReign,项目名称:UOMachine,代码行数:29,代码来源:ClientHook.cs

示例3: AnalyzeMessage

 /// <summary>
 /// 解析。
 /// </summary>
 /// <param name="message">メッセージ。</param>
 /// <param name="wparam">wparam。</param>
 /// <param name="lparam">lparam。</param>
 internal override void AnalyzeMessage(int message, IntPtr wparam, IntPtr lparam)
 {
     if (!HasFocus() ||
         message != NativeCommonDefine.WM_COMMAND ||
         ControlId != (wparam.ToInt32() & 0xFFFF))
     {
         return;
     }
     switch ((int)(wparam.ToInt32() >> 16) & 0xFFFF)
     {
         case NativeComboBox.CBN_SELCHANGE:
             AddSentence(new TokenName(), ".EmulateSelectItem(" + NativeComboBox.GetCurSelInTarget(WindowHandle), new TokenAsync(CommaType.Before), ");");
             break;
         case NativeComboBox.CBN_EDITCHANGE:
             if (!_isDropDownList)
             {
                 string comboText = GetWindowText();
                 int curSel = NativeComboBox.GetCurSelInTarget(WindowHandle);
                 if (curSel != -1)
                 {
                     string itemText = NativeComboBox.GetLBTextInTarget(WindowHandle, curSel);
                     if (comboText == itemText)
                     {
                         return;
                     }
                 }
                 AddSentence(new TokenName(), ".EmulateChangeEditText(" + NativeEditGenerator.AdjustText(comboText), new TokenAsync(CommaType.Before), ");");
             }
             break;
         default:
             break;
     }
 }
开发者ID:Codeer-Software,项目名称:Friendly.Windows.NativeStandardControls,代码行数:39,代码来源:NativeComboBoxGenerator.cs

示例4: OnCommand

 internal void OnCommand(IntPtr wParam)
 {
     if (((wParam.ToInt32() >> 16) & 0xffff) == SafeNativeMethods.THBN_CLICKED)
     {
         _thumbButtons[wParam.ToInt32() & 0xffff].OnClick();
     }
 }
开发者ID:RoDaniel,项目名称:featurehouse,代码行数:7,代码来源:ThumbButtonManager.cs

示例5: HandleMessage

 private void HandleMessage(IntPtr handle, int msg, IntPtr instance, IntPtr param1, IntPtr param2)
 {
     if(msg == MIM_OPEN)
     {
     }
     else if(msg == MIM_CLOSE)
     {
     }
     else if(msg == MIM_DATA)
     {
         delegateQueue.Post(HandleShortMessage, param1.ToInt32());
     }
     else if(msg == MIM_MOREDATA)
     {
         delegateQueue.Post(HandleShortMessage, param1.ToInt32());
     }
     else if(msg == MIM_LONGDATA)
     {
         delegateQueue.Post(HandleSysExMessage, param1);
     }
     else if(msg == MIM_ERROR)
     {
         delegateQueue.Post(HandleInvalidShortMessage, param1.ToInt32());
     }
     else if(msg == MIM_LONGERROR)
     {
         delegateQueue.Post(HandleInvalidSysExMessage, param1);
     }
 }
开发者ID:Andrea,项目名称:MercuryParticleEngine,代码行数:29,代码来源:InputDevice.Messaging.cs

示例6: HiWord

 public static int HiWord(IntPtr dWord)
 {
     if ((dWord.ToInt32() & 0x80000000) == 0x80000000)
         return (dWord.ToInt32() >> 16);
     else
         return (dWord.ToInt32() >> 16) & 0xffff;
 }
开发者ID:Zexks,项目名称:QLite,代码行数:7,代码来源:NativeMethods.cs

示例7: ProcessWinMessage

 public void ProcessWinMessage(int msg, IntPtr wParam, IntPtr lParam)
 {
     if (msg != 537)
         return;
     Console.WriteLine("UsbDetector\t:\tmsg = 0x{0} - wParam = 0x{1} - lParam = 0x{2}", (object)msg.ToString("X"), (object)wParam.ToInt32().ToString("X"), (object)lParam.ToInt32().ToString("X"));
     switch (wParam.ToInt32())
     {
         case 24:
             Console.WriteLine("UsbDetector\t:Device config changed");
             break;
         case 32768:
             Console.WriteLine("UsbDetector\t:Device arrival");
             Console.WriteLine("DEVICE INTERFACE: Arrived");
             this.OnStateChanged(this.GetDeviceName(lParam), DeviceState.Attached);
             break;
         case 32771:
             Console.WriteLine("UsbDetector\t:Device remove pending");
             break;
         case 32772:
             Console.WriteLine("UsbDetector\t:Device remove complete");
             Console.WriteLine("DEVICE INTERFACE: Removed");
             this.OnStateChanged(this.GetDeviceName(lParam), DeviceState.Unattached);
             break;
     }
 }
开发者ID:kaaLabs15,项目名称:LoRa,代码行数:25,代码来源:UsbDetector.cs

示例8: HookCallback

    private static IntPtr HookCallback(int code, IntPtr wParam, IntPtr lParam)
    {
      if (code == 0)
      {
        KeyboardDescription description = (KeyboardDescription)Marshal.PtrToStructure(lParam, typeof(KeyboardDescription));

        bool isDown = false;
        if (wParam.ToInt32() == 0x100 || wParam.ToInt32() == 0x104)
          isDown = true;

        Keys keys = (Keys)description.KeyCode;

        if (isDown)
        {
          if (KeyDown != null)
            KeyDown(keys);
        }
        else
        {
          if (KeyUp != null)
            KeyUp(keys);
        }
      }

      return CallNextHookEx(hookHandle, code, wParam, lParam);
    }
开发者ID:viktortat,项目名称:TCPChat,代码行数:26,代码来源:KeyBoard.cs

示例9: SetUpCodeCave

        public void SetUpCodeCave()
        {
            CodeCaveHelper cv = new CodeCaveHelper();
            //Let's get some space for our codecave
            origanGetNextPacket = memRead.GetCallFunction(Addresses.MyAddresses.GetnextPacket.Address);
            CodeCaveAdr = WinApi.VirtualAllocEx(TibiaHandle, IntPtr.Zero, 1024, WinApi.AllocationType.Commit | WinApi.AllocationType.Reserve, WinApi.MemoryProtection.ExecuteReadWrite);
            GotPacketAdr = WinApi.VirtualAllocEx(TibiaHandle, IntPtr.Zero, 1, WinApi.AllocationType.Commit | WinApi.AllocationType.Reserve, WinApi.MemoryProtection.ExecuteReadWrite);

            memRead.WriteByte(GotPacketAdr.ToInt32(), 0);
            cv.AddLine((byte)0xE8);
            cv.AddInt(((int)origanGetNextPacket - (CodeCaveAdr.ToInt32()) - 5));  // calls getnextPacket

            cv.AddLine((byte)0x8b, (byte)0xd8); // store eax

            cv.AddLine((byte)0xc7, (byte)0x05, (UInt32)GotPacketAdr.ToInt32(), (UInt32)0x00000001); //sets gotpacket to 1

            cv.AddLine((byte)0x90);
            cv.AddLine((byte)0xA1, (UInt32)GotPacketAdr.ToInt32());

            cv.AddLine((byte)0x83, (byte)0xF8, (byte)1);
            cv.AddLine((byte)0x74, (byte)0xF6);
            cv.AddLine((byte)0x8b, (byte)0xC3);
            cv.AddLine((byte)0xC3);

            System.Windows.Forms.Clipboard.SetText(CodeCaveAdr.ToString("X"));

            memRead.WriteBytes(CodeCaveAdr.ToInt32(), cv.Data, (uint)cv.Data.Length);
            Thread t = new Thread(new ThreadStart(ReadingPacket));
            running = true;
            t.Start();
            ReplaceCode();
        }
开发者ID:YohanAugusto,项目名称:MemoryScanner,代码行数:32,代码来源:PacketListner.cs

示例10: HookProcedureCallback

        private static int HookProcedureCallback(int nCode, IntPtr wParam, IntPtr lParam)
        {
            if (nCode >= 0)
            {
                if (wParam.ToInt32() == (int)Native.Message.WM_LBUTTONDBLCLK 
                    && !IsReEnteredCallback())
                {
                    var handle = Process.GetCurrentProcess().MainWindowHandle;
                    FindSlideViewWindowHandle(handle);
                    if (IsMouseWithinSlideViewWindow()
                        && DoubleClick != null)
                    {
                        DoubleClick(selectedRange);
                    }
                }

                // Left mouse button up/released
                if (wParam.ToInt32() == (uint)Native.Message.WM_LBUTTONUP)
                {
                    if (LeftButtonUp != null)
                    {
                        LeftButtonUp();
                    }
                }

                UpdateStartTime();  
            }
            return Native.CallNextHookEx(0, nCode, wParam, lParam);
        }
开发者ID:nus-fboa2016-PL,项目名称:PowerPointLabs,代码行数:29,代码来源:PPMouse.cs

示例11: HookProc

        public int HookProc(int nCode, IntPtr wParam, IntPtr lParam)
        {
            if (wParam.ToInt32() == Win32API.WM_KEYUP || wParam.ToInt32() == Win32API.WM_SYSKEYUP)
            {

                int vkCode = Marshal.ReadInt32(lParam);
                KeyboardHookStruct MyKeyboardHookStruct = (KeyboardHookStruct)Marshal.PtrToStructure(lParam, typeof(KeyboardHookStruct));
                Keys keyData = (Keys)MyKeyboardHookStruct.vkCode;

                //int check_i = 0;

                if (string.Format(keyData.ToString()) == "F12")
                {
                    DateTime dt = DateTime.Now;
                    string Time_name = dt.ToFileTime().ToString();
                    // 建立檔案串流(@ 可取消跳脫字元 escape sequence)
                    StreamWriter sw = new StreamWriter(@"D:\" + Time_name + ".txt");
                    foreach (var aaa in listView1.Items) sw.WriteLine(aaa);// 寫入文字
                    sw.Close();						// 關閉串流
                }else {
                    listView1.Items.Add(string.Format(keyData.ToString()));
                }
            }
            return Win32API.CallNextHookEx(m_hookHandle, nCode, wParam, lParam);
        }
开发者ID:seven2966,项目名称:data,代码行数:25,代码来源:Form1.cs

示例12: AnalyzeMessage

 /// <summary>
 /// 解析。
 /// </summary>
 /// <param name="message">メッセージ。</param>
 /// <param name="wparam">wparam。</param>
 /// <param name="lparam">lparam。</param>
 internal override void AnalyzeMessage(int message, IntPtr wparam, IntPtr lparam)
 {
     if (HasFocus() &&
         message == NativeCommonDefine.WM_COMMAND &&
         ControlId == (wparam.ToInt32() & 0xFFFF) &&
         ((int)(wparam.ToInt32() >> 16) & 0xFFFF) == NativeListBox.LBN_SELCHANGE)
     {
         OnSelected();
     }
 }
开发者ID:Codeer-Software,项目名称:Friendly.Windows.NativeStandardControls,代码行数:16,代码来源:NativeListBoxGenerator.cs

示例13: AnalyzeMessage

 /// <summary>
 /// 解析。
 /// </summary>
 /// <param name="message">メッセージ。</param>
 /// <param name="wparam">wparam。</param>
 /// <param name="lparam">lparam。</param>
 internal override void AnalyzeMessage(int message, IntPtr wparam, IntPtr lparam)
 {
     if (HasFocus() &&
         message == NativeCommonDefine.WM_COMMAND &&
         ControlId == (wparam.ToInt32() & 0xFFFF) &&
         ((int)(wparam.ToInt32() >> 16) & 0xFFFF) == NativeEdit.EN_UPDATE)
     {
         AddSentence(new TokenName(), ".EmulateChangeText(" + AdjustText(GetWindowText()), new TokenAsync(CommaType.Before), ");");
     }
 }
开发者ID:Codeer-Software,项目名称:Friendly.Windows.NativeStandardControls,代码行数:16,代码来源:NativeEditGenerator.cs

示例14: IdToName

		internal static string IdToName (IntPtr id)
		{
			var dp = DependencyProperty.Lookup (id);
			if (dp != null)
				return dp.Name;

			if (Enum.IsDefined (typeof (WeakRefs), id.ToInt32 ()))
				return Enum.GetName (typeof (WeakRefs), id.ToInt32 ());

			return "???";
		}
开发者ID:fmaulanaa,项目名称:moon,代码行数:11,代码来源:NativeDependencyObjectHelper.cs

示例15: WindowHelper

 internal WindowHelper(string username)
 {
     FindWindow formfw = new FindWindow(new IntPtr(0), "StandardFrame", username + " - 客服工作台", 100);
     hwndwork = formfw.FoundHandle;
     dm.SetWindowState(hwndwork.ToInt32(), 8);
     dm.SetWindowState(hwndwork.ToInt32(), 1);
     FindWindow fw = new FindWindow(formfw.FoundHandle, "Internet Explorer_Server", "", 100);
     hwndworkmsg = fw.FoundHandle;
     FindWindow workeditfw = new FindWindow(formfw.FoundHandle, "RichEditComponent", "", 100);
     hwndworkedit = workeditfw.FoundHandle;
 }
开发者ID:3guy,项目名称:testRe,代码行数:11,代码来源:WindowHelper.cs


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