public void mySendKeys() { if (InvokeRequired) { BeginInvoke(new VoidDelegate(mySendKeys)); } else { try { Global.KeysDisabled = true; if (KeyFunctions.numToBackspace > 0) { SendKeys.Send(KeyFunctions.GetBackspaces()); } SendKeys.Flush(); string o = KeyFunctions.getOutputString(); if (o != null && o != "") { SendKeys.Send(o); } Global.KeysDisabled = false; } catch (Exception e) { Log.WriteLine("[WA] SendKeys Exception: " + e.Message + "\n\n" + e.StackTrace); } } }
private void tmrPreviewUpdate_Tick(object sender, EventArgs e) { int tk = Environment.TickCount; WriteWB(KeyFunctions.getPreviewString(txtPrint.Text, "")); if (Environment.TickCount - tk > 500) { WriteWB("Preview is disabled due to timeout (Greater than 100ms execution time)"); tmrPreviewUpdate.Enabled = false; } }
public void MyKeyPressed(object sender, KeyPressEventArgs e) { if (Global.KeysDisabled || e == null) { return; } if (e.KeyChar == 22) // Ctrl+V { KeyFunctions.PasteKey(); return; } if (KeyFunctions.addKey(e.KeyChar.ToString())) { System.Threading.Thread t = new System.Threading.Thread(mySendKeys); t.Start(); } }