vb@rchiv
VB Classic
VB.NET
ADO.NET
VBA
C#
sevDataGrid - Gönnen Sie Ihrem SQL-Kommando diesen krönenden Abschluß!  
 vb@rchiv Quick-Search: Suche startenErweiterte Suche starten   Impressum  | Datenschutz  | vb@rchiv CD Vol.6  | Shop Copyright ©2000-2025
 
zurück

 Sie sind aktuell nicht angemeldet.Funktionen: Einloggen  |  Neu registrieren  |  Suchen

Visual-Basic Einsteiger
Re: Screenshot 
Autor: ModeratorDieter (Moderator)
Datum: 12.07.02 23:38

Hi cdhunter,

alles was Du hierzu brauchst, ist eine Form mit einem Timer-Control, sowie ein PictureBox-Control.

Und dann folgender Code:
<code><font color=#000099>Option</font> <font color=#000099>Explicit</font>
 
<font color=green>' zunächst die benötigten API-Deklarationen</font>
<font color=#000099>Private</font> <font color=#000099>Declare</font> <font _
  color=#000099>Function</font> BitBlt <font color=#000099>Lib</font> "gdi32" _
  (<font color=#000099>ByVal</font> hDestDC <font color=#000099>As</font> <font _
  color=#000099>Long</font>, <font color=#000099>ByVal</font> x <font _
  color=#000099>As</font> <font color=#000099>Long</font>, _
  <font color=#000099>ByVal</font> y <font color=#000099>As</font> <font _
  color=#000099>Long</font>, <font color=#000099>ByVal</font> nWidth <font _
  color=#000099>As</font> <font color=#000099>Long</font>, _
  <font color=#000099>ByVal</font> nHeight <font color=#000099>As</font> <font _
  color=#000099>Long</font>, <font color=#000099>ByVal</font> hSrcDC <font _
  color=#000099>As</font> <font color=#000099>Long</font>, _
  <font color=#000099>ByVal</font> xSrc <font color=#000099>As</font> <font _
  color=#000099>Long</font>, <font color=#000099>ByVal</font> ySrc <font _
  color=#000099>As</font> <font color=#000099>Long</font>, _
  <font color=#000099>ByVal</font> dwRop <font color=#000099>As</font> <font _
  color=#000099>Long</font>) <font color=#000099>As</font> <font _
  color=#000099>Long</font>
 
<font color=#000099>Private</font> <font color=#000099>Declare</font> <font _
  color=#000099>Function</font> GetDC <font color=#000099>Lib</font> "user32" _
  (<font color=#000099>ByVal</font> hWnd <font color=#000099>As</font> <font _
  color=#000099>Long</font>) <font color=#000099>As</font> <font _
  color=#000099>Long</font>
 
<font color=#000099>Private</font> <font color=#000099>Declare</font> <font _
  color=#000099>Function</font> ReleaseDC <font color=#000099>Lib</font> _
  "user32" _
  (<font color=#000099>ByVal</font> hWnd <font color=#000099>As</font> <font _
  color=#000099>Long</font>, <font color=#000099>ByVal</font> hdc <font _
  color=#000099>As</font> <font color=#000099>Long</font>) <font _
  color=#000099>As</font> <font color=#000099>Long</font>
 
<font color=#000099>Private</font> <font color=#000099>Declare</font> <font _
  color=#000099>Function</font> GetDesktopWindow <font color=#000099>Lib</font> _
  "user32" _
  () <font color=#000099>As</font> <font color=#000099>Long</font>
 
<font color=#000099>Private</font> iMin <font color=#000099>As</font> <font _
  color=#000099>Integer</font>
 
 
<font color=#000099>Private</font> <font color=#000099>Sub</font> Form_Load()
  <font color=green>' Timer initialisieren</font>
  Timer1.Interval = 60000
  Timer1.Enabled = <font color=#000099>True</font>
 
  <font color=green>' PictureBox auf Bildschirmgröße bringen und</font>
  <font color=green>' unsichtbar machen</font>
  <font color=#000099>With</font> Picture1
    .BorderStyle = 0
    .Move 0, 0, Screen.Width, Screen.Height
    .Visible = <font color=#000099>False</font>
  <font color=#000099>End</font> <font color=#000099>With</font>
<font color=#000099>End</font> <font color=#000099>Sub</font>
 
 
<font color=#000099>Private</font> <font color=#000099>Sub</font> Timer1_Timer()
  <font color=green>' Minuten hochzählen</font>
  iMin = iMin + 1
  <font color=#000099>If</font> iMin = 10 <font color=#000099>Then</font>
    iMin = 0
    SaveScreen
  <font color=#000099>End</font> <font color=#000099>If</font>
<font color=#000099>End</font> <font color=#000099>Sub</font>
 
 
<font color=#000099>Private</font> <font color=#000099>Sub</font> SaveScreen()
  <font color=green>' aktuellen Bildschirm-Inhalt in PictureBox</font>
  <font color=green>' zwischenspeichern</font>
  Static iBild <font color=#000099>As</font> <font color=#000099>Integer</font>
 
  <font color=#000099>Dim</font> hWnd <font color=#000099>As</font> <font _
    color=#000099>Long</font>
  <font color=#000099>Dim</font> DC <font color=#000099>As</font> <font _
  color=#000099>Long</font>
 
  <font color=#000099>With</font> Picture1
    <font color=green>' Desktop-Fenster</font>
    hWnd = GetDesktopWindow()
 
    <font color=green>' Zugang zum Device-Context</font>
    DC = GetDC(hWnd)
 
    <font color=green>' in PictureBox blitten</font>
    .AutoRedraw = <font color=#000099>True</font>
    .Cls
    BitBlt .hdc, 0, 0, _
      Screen.Width / Screen.TwipsPerPixelX, _
      Screen.Height / Screen.TwipsPerPixelY, DC, 0, 0, _
      vbSrcCopy
 
    <font color=green>' DC wieder freigeben</font>
    ReleaseDC hWnd, DC
 
    <font color=green>' Picture-Inhalt speichern</font>
    .Picture = .Image
    .AutoRedraw = <font color=#000099>False</font>
 
    iBild = iBild + 1
    SavePicture .Image, _
      "d:	empild" + <font color=#000099>CStr</font>(iBild) + ".bmp"
  <font color=#000099>End</font> <font color=#000099>With</font>
<font color=#000099>End</font> <font color=#000099>Sub</font></code>
Cu
Dieter
alle Nachrichten anzeigenGesamtübersicht  |  Zum Thema  |  Suchen

 ThemaViews  AutorDatum
Screenshot85cdhunter12.07.02 23:20
Re: Screenshot307ModeratorDieter12.07.02 23:38
Re: Screenshot91hans13.07.02 14:11
Re: Screenshot39hans13.07.02 14:25
Re: Screenshot38hans13.07.02 14:30
Re: Screenshot38hans13.07.02 14:36
Re: Screenshot211ModeratorDieter13.07.02 14:46
Re: Screenshot34hans13.07.02 14:49
Re: Screenshot265ModeratorDieter13.07.02 15:10
Re: Screenshot40hans13.07.02 15:42

Sie sind nicht angemeldet!
Um auf diesen Beitrag zu antworten oder neue Beiträge schreiben zu können, müssen Sie sich zunächst anmelden.

Einloggen  |  Neu registrieren

Funktionen:  Zum Thema  |  GesamtübersichtSuchen 

nach obenzurück
 
   

Copyright ©2000-2025 vb@rchiv Dieter Otter
Alle Rechte vorbehalten.
Microsoft, Windows und Visual Basic sind entweder eingetragene Marken oder Marken der Microsoft Corporation in den USA und/oder anderen Ländern. Weitere auf dieser Homepage aufgeführten Produkt- und Firmennamen können geschützte Marken ihrer jeweiligen Inhaber sein.

Diese Seiten wurden optimiert für eine Bildschirmauflösung von mind. 1280x1024 Pixel