Пример #1
0
        public static void DoubleClickListView(IntPtr hwnd, uint processId, int item, int subitem)
        {
            NMHDR  nMHDR  = new NMHDR();
            POINT  pOINT  = new POINT();
            IntPtr zero   = IntPtr.Zero;
            IntPtr intPtr = IntPtr.Zero;

            nMHDR.hwndFrom = (int)hwnd;
            nMHDR.idFrom   = 116;
            nMHDR.code     = 515;
            IntPtr zero1 = IntPtr.Zero;

            zero1 = ListViewItem1.OpenProcess(Win32ProcessAccessType.AllAccess, false, processId);
            zero  = ListViewItem1.VirtualAllocEx(zero1, IntPtr.Zero, 2048, Win32AllocationTypes.MEM_COMMIT, Win32MemoryProtection.PAGE_READWRITE);
            IntPtr intPtr1 = IntPtr.Zero;
            int    num     = 0;

            ListViewItem1.WriteProcessMemory(zero1, zero, ref nMHDR, (uint)Marshal.SizeOf(typeof(NMHDR)), out num);
            pOINT.x = 31;
            pOINT.y = 31;
            intPtr  = ListViewItem1.VirtualAllocEx(zero1, IntPtr.Zero, 2048, Win32AllocationTypes.MEM_COMMIT, Win32MemoryProtection.PAGE_READWRITE);
            ListViewItem1.WriteProcessMemory(zero1, intPtr, ref pOINT, (uint)Marshal.SizeOf(typeof(POINT)), out num);
            NMITEMACTIVATE nMITEMACTIVATE = new NMITEMACTIVATE()
            {
                hdr       = zero,
                iItem     = item,
                iSubItem  = subitem,
                uOldState = 2,
                uNewState = 0,
                ptAction  = intPtr
            };
            IntPtr zero2 = IntPtr.Zero;

            zero2 = ListViewItem1.VirtualAllocEx(zero1, IntPtr.Zero, 2048, Win32AllocationTypes.MEM_COMMIT, Win32MemoryProtection.PAGE_READWRITE);
            ListViewItem1.WriteProcessMemory(zero1, zero2, ref nMITEMACTIVATE, (uint)Marshal.SizeOf(typeof(NMITEMACTIVATE)), out num);
            ListViewItem1.SendMessageTimeout(hwnd, 78, (IntPtr)116, zero2, 2, 5000, IntPtr.Zero);
        }
Пример #2
0
 internal static extern bool WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, ref NMHDR lpBuffer, uint nSize, out int lpNumberOfBytesWritten);