當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。