fork download
  1. using System;
  2. using System.Drawing;
  3. using System.Windows.Forms;
  4. using System.Runtime.InteropServices;
  5. using System.Diagnostics;
  6.  
  7. namespace WindowsFormsApplication1
  8. {
  9. public partial class Form1 : Form
  10. {
  11.  
  12. [DllImport("user32.dll")]
  13. static extern bool SetForegroundWindow(IntPtr hWnd);
  14. public Form1()
  15. {
  16. InitializeComponent();
  17. }
  18. const int w = 40;
  19. const int h = 40;
  20. const int x = 10;
  21. const int y = 5;
  22. string[] optkey = new string[]
  23. {
  24. "",
  25. "+", //SHIFT
  26. "^", //CTRL
  27. "+^",//SHIFT+CTRL
  28. "%" //ALT
  29. };
  30. private void Form1_Load(object sender, EventArgs e)
  31. {
  32. this.FormBorderStyle = FormBorderStyle.FixedToolWindow;
  33. this.ClientSize = new Size(w*x, h*y);
  34. for (int i = 0; i < y; i++)
  35. {
  36. for (int j = 0; j < x; j++)
  37. {
  38. Button button;
  39. button = new Button();
  40. button.Location = new Point(j * w, i * h);
  41. button.Text = (i*x + j+1).ToString("00");
  42.  
  43. button.Size = new Size(w, h);
  44. button.Tag = optkey[i] + (j + 1).ToString();
  45. button.Click += new EventHandler(button_Click);
  46. this.Controls.Add(button);
  47. }
  48. }
  49. }
  50. void button_Click(object sender, EventArgs e)
  51. {
  52. Process[] p = Process.GetProcessesByName("TVTest");
  53. IntPtr hWnd = (IntPtr)p[0].MainWindowHandle;
  54. SetForegroundWindow(hWnd);
  55. SendKeys.Send(((Button)sender).Tag.ToString());
  56. }
  57. }
  58. }
  59.  
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty