Exemple #1
0
 /// <summary>
 /// Locks the input for <code>interval * count</code> milliseconds. The
 /// lock can be canceled every <code>interval</code> milliseconds. If count is
 /// negative, the lock will be active until cancelled.
 /// </summary>
 /// <param name="interval">The interval to lock the input.</param>
 /// <param name="count">How often to lock the input.</param>
 /// <param name="force">If <code>true</code>, the lock cannot be canceled
 /// by pressing Control+Alt+Delete</param>
 public InputLocker(int interval, int count, bool force)
 {
     this.interval = interval;
     this.count = count;
     hook = new JournalPlaybackHook();
     hook.GetNextJournalMessage += new JournalPlaybackHook.JournalQuery(hook_GetNextJournalMessage);
     if (force)
         hook.JournalCancelled += new EventHandler(hook_JournalCancelled);
     hook.StartHook();
 }
 /// <summary>
 /// Locks the input for <code>interval * count</code> milliseconds. The
 /// lock can be canceled every <code>interval</code> milliseconds. If count is
 /// negative, the lock will be active until cancelled.
 /// </summary>
 /// <param name="interval">The interval to lock the input.</param>
 /// <param name="count">How often to lock the input.</param>
 /// <param name="force">If <code>true</code>, the lock cannot be canceled
 /// by pressing Control+Alt+Delete</param>
 public InputLocker(int interval, int count, bool force)
 {
     this.interval = interval;
     this.count    = count;
     hook          = new JournalPlaybackHook();
     hook.GetNextJournalMessage += new JournalPlaybackHook.JournalQuery(hook_GetNextJournalMessage);
     if (force)
     {
         hook.JournalCancelled += new EventHandler(hook_JournalCancelled);
     }
     hook.StartHook();
 }
Exemple #3
0
 private void playHotkey_HotkeyPressed(object sender, EventArgs e)
 {
     if (state == MacroState.STOPPED)
     {
         lastTickCount = Environment.TickCount;
         state = MacroState.PLAYING;
         if (llhook)
         {
             llindex = 0;
             if(bi) iblock = new InputBlocker();
             playTimer.Interval = 1;
             playTimer.Enabled = true;
         }
         else
         {
             index = 0;
             play = new JournalPlaybackHook();
             play.GetNextJournalMessage += new JournalPlaybackHook.JournalQuery(play_GetNextJournalMessage);
             play.StartHook();
         }
     }
     else if (state == MacroState.PLAYING)
     {
         // do nothing
     }
     else
     {
         if (llhook)
         {
             kbd.Unhook();
             mouse.Unhook();
         }
         else
         {
             rec.Unhook();
         }
         state = MacroState.STOPPED;
         RemoveEvent(playHotkey.KeyCode);
     }
     UpdateIcons();
 }