Wenn dies Ihr erster Besuch hier ist,
lesen Sie bitte zuerst die Hilfe - Häufig gestellte Fragen
durch. Sie müssen sich vermutlich registrieren,
bevor Sie Beiträge verfassen können. Klicken Sie oben auf 'Registrieren', um den Registrierungsprozess zu
starten. Sie können auch jetzt schon Beiträge lesen. Suchen Sie sich einfach das Forum aus, das Sie am meisten
interessiert.
<font color="#0000FF">private</font> <font color="#0000FF">void</font> button1_Click(<font color="#0000FF">object</font> sender, System.<font color="#008080">EventArgs</font> e)
{
<font color="#008000">// nur aktives Fenster oder der komplette Desktop</font>
<font color="#0000FF">if</font> (checkBox1.Checked)
{
keybd_event(VK_MENU, 0, 0, 0);
keybd_event(VK_SNAPSHOT, 0, 0, 0);
keybd_event(VK_SNAPSHOT, 0, KEYEVENTF_KEYUP, 0);
keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, 0);
}
<font color="#0000FF">else</font>
{
keybd_event(VK_SNAPSHOT, 0, 0, 0);
keybd_event(VK_SNAPSHOT, 0, KEYEVENTF_KEYUP, 0);
}
<font color="#008080">Application</font>.DoEvents();
pictureBox1.<font color="#008080">Image</font> = (<font color="#008080">Image</font>)<font color="#008080">Clipboard</font>.GetDataObject().GetData(<font color="#008080">DataFormats</font>.<font color="#008080">Bitmap</font>);
}
</code>
Über die Win32-API-Funktion <b>keybd_event</b> wird die DRUCK-Taste ferngesteuert, so dass der von Windows angelegte Screenshot in der Zwischenablage verfügbar ist. Wenn nur das aktive Fenster berücksichtigt werden soll, wird vorher die ALT-Taste ausgelöst
Comment