fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using System.Runtime.InteropServices;
  10. using System.Diagnostics;
  11.  
  12. namespace WindowsFormsApplication1
  13. {
  14. public partial class Form1 : Form
  15. {
  16. [DllImport("user32.dll", CharSet = CharSet.Unicode)]
  17. private static extern bool PostMessage(
  18. IntPtr hWnd, Int32 Msg, IntPtr wParam, IntPtr lParam);
  19. public Form1()
  20. {
  21. InitializeComponent();
  22. }
  23. Button button1;
  24. private void Form1_Load(object sender, EventArgs e)
  25. {
  26. this.FormBorderStyle = FormBorderStyle.FixedToolWindow;
  27. this.ClientSize = new Size(200, 40);
  28. button1 = new Button();
  29. button1.Text = "チャンネル変更";
  30. button1.Size = new Size(200, 40);
  31. button1.Click += new EventHandler(button1_Click);
  32. this.Controls.Add(button1);
  33. }
  34. const int WM_KEYDOWN = 0x100;
  35. void button1_Click(object sender, EventArgs e)
  36. {
  37. Process[] p = Process.GetProcessesByName("TVTest");
  38. IntPtr hWnd = (IntPtr)p[0].MainWindowHandle;
  39. PostMessage(hWnd, WM_KEYDOWN, (IntPtr)Keys.Right, IntPtr.Zero);
  40. }
  41. }
  42. }
  43.  
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty