Exemplo n.º 1
0
        void Button1Click(object sender, EventArgs e)
        {
            DmSoft dm = new DmSoft();

            dm.Delay(2000);
            dm.KeyPressStr(".ddaccJJdAA23JKDJSK23dlaJdjlj666");
        }
Exemplo n.º 2
0
 internal static int KeyPressStr(string keyStr, int iszs = 0, int delay = 6)
 {
     try
     {
         var dm         = new DmSoft();
         var isCapsLock = (((ushort)GetKeyState(0x14)) & 0xffff) != 0;
         if (isCapsLock)
         {
             dm.KeyPress(20);
         }
         foreach (var chr in keyStr)
         {
             if (char.IsUpper(chr))
             {
                 dm.KeyPress(20);
                 dm.Delay(6);
                 dm.KeyPressChar(chr.ToString());
                 dm.Delay(6);
                 dm.KeyPress(20);
             }
             else
             {
                 dm.KeyPressChar(chr.ToString());
             }
             dm.Delay(iszs == 0 ? delay : new Random().Next(1 + delay, 100 + delay));
         }
         if (isCapsLock)
         {
             dm.KeyPress(20);
         }
     }
     catch
     {
         return(0);
     }
     return(1);
 }