using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Runtime.InteropServices; using System.Diagnostics; namespace WindowsFormsApplication1 { public partial class Form1 : Form { //Søg efter aktive vinduer [DllImport("user32.dll")] public static extern IntPtr FindWindow(String sClassName, String sAppName); [DllImport("user32.dll")] private static extern bool RegisterHotkey(IntPtr hWnd, int id, uint fsModifiers, uint vk); [DllImport("user32.dll")] static extern bool SetForegroundWindow(IntPtr hWnd); public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { // Gem vindue som thisWindow IntPtr thisWindow = FindWindow(null, "Unavngivet - Notesblok"); // Sæt thisWindow i forgrunden SetForegroundWindow(thisWindow); SendKeys.Send("Hello World!"); } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)