Exemple #1
0
        public static async Task EnterString(IntPtr handle, string str)
        {
            List <int> VKs = VKsConverter.Convert(str);

            for (int i = 0; i < VKs.Count(); i++)
            {
                await Task.Delay(100);

                PostMessage(handle, WM_KEYDOWN, VKs[i], 0);
                await Task.Delay(100);

                PostMessage(handle, WM_KEYUP, VKs[i], 0);
            }
        }
Exemple #2
0
        public static async Task EnterCredentials(IntPtr handle, string login, string password)
        {
            List <int> VKs = new List <int>();

            VKs.AddRange(VKsConverter.Convert(login));
            VKs.Add(VKsConverter.TAB_VK);
            VKs.AddRange(VKsConverter.Convert(password));

            for (int i = 0; i < VKs.Count(); i++)
            {
                if (login.IndexOf("@") == i)
                {
                    await Task.Delay(100);

                    PostMessage(handle, WM_KEYDOWN, VKsConverter.SHIFT_VK, 0);
                }

                await Task.Delay(100);

                PostMessage(handle, WM_KEYDOWN, VKs[i], 0);

                if (login.IndexOf("@") == i)
                {
                    await Task.Delay(100);

                    PostMessage(handle, WM_KEYUP, VKsConverter.SHIFT_VK, 0);
                }
            }

            await Task.Delay(5000);

            PostMessage(handle, WM_KEYDOWN, VKsConverter.ENTER_VK, 0);
            await Task.Delay(100);

            PostMessage(handle, WM_KEYUP, VKsConverter.ENTER_VK, 0);
            await Task.Delay(15000);

            PostMessage(handle, WM_KEYDOWN, VKsConverter.ENTER_VK, 0);
            await Task.Delay(100);

            PostMessage(handle, WM_KEYUP, VKsConverter.ENTER_VK, 0);
            await Task.Delay(1000);
        }