Exemplo n.º 1
0
        public static void Scroll(IntPtr hWnd, int vertical, int horizontal)
        {
            const int WM_VSCROLL   = 0x115; // Vertical scroll
            const int WM_HSCROLL   = 0x0114;
            const int SB_LINELEFT  = 0;
            const int SB_LINEUP    = 0; // Scrolls one line up
            const int SB_LINEDOWN  = 1; // Scrolls one line down
            const int SB_LINERIGHT = 1;

            if (vertical != 0)
            {
                if (vertical > 0)
                {
                    PInvoke.SendMessage(hWnd, WM_VSCROLL, (IntPtr)SB_LINEUP, IntPtr.Zero);
                }
                else
                {
                    PInvoke.SendMessage(hWnd, WM_VSCROLL, (IntPtr)SB_LINEDOWN, IntPtr.Zero);
                }
            }

            if (horizontal != 0)
            {
                if (horizontal > 0)
                {
                    PInvoke.SendMessage(hWnd, WM_HSCROLL, (IntPtr)SB_LINERIGHT, IntPtr.Zero);
                }
                else
                {
                    PInvoke.SendMessage(hWnd, WM_HSCROLL, (IntPtr)SB_LINELEFT, IntPtr.Zero);
                }
            }
        }
Exemplo n.º 2
0
        // get Name property of a control (winforms only)
        // not supported by WinMo controls, always empty
        public static string GetControlName(IntPtr handle)
        {
            var sb = new StringBuilder();

            PInvoke.SendMessage(handle, (int)PInvoke.GetControlNameMessage, (IntPtr)(sb.Capacity * 2), sb);
            var res = sb.ToString();

            return(res);
        }
Exemplo n.º 3
0
        public static void Click(IntPtr handle, Location location)
        {
            if (location != null)
            {
                var p = new PInvoke.POINT(); // DOESN'T WORK! not getting clicked!
                p.X = location.X;
                p.Y = location.Y;
                PInvoke.ScreenToClient(handle, ref p);
                var lParam = p.X | (p.Y << 16);

                unsafe
                {
                    PInvoke.SendMessage(handle, PInvoke.WM_LBUTTONDOWN, (IntPtr)0x1, new IntPtr(&p));
                    PInvoke.SendMessage(handle, PInvoke.WM_LBUTTONUP, (IntPtr)0x1, new IntPtr(&p));
                }
            }
            else
            {
                PInvoke.SendMessage(handle, PInvoke.WM_LBUTTONDOWN, (IntPtr)0x1, (IntPtr)0);
                PInvoke.SendMessage(handle, PInvoke.WM_LBUTTONUP, (IntPtr)0x1, (IntPtr)0);
            }
        }
Exemplo n.º 4
0
 public static void Click(IntPtr handle)
 {
     PInvoke.SendMessage(handle, PInvoke.WM_LBUTTONDOWN, (IntPtr)0x1, (IntPtr)0);
     PInvoke.SendMessage(handle, PInvoke.WM_LBUTTONUP, (IntPtr)0x1, (IntPtr)0);
 }