vb@rchiv
VB Classic
VB.NET
ADO.NET
VBA
C#
SEPA-Dateien erstellen inkl. IBAN-, BLZ-/Kontonummernprüfung  
 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

Fortgeschrittene Programmierung
Webcambild vernünftig speichern 
Autor: Doom
Datum: 31.10.04 21:51

Hallo,

ich habe ein Problem mit der Speicherung des Bildes meiner Webcam. Ich habe diesen Sourcecode im netzt gefunden, er funktioniert soweit auch super nur wenn es zum Speichern des bildes geht wirds Komisch! Ich habe den Bereich mal rot makiert. Es wird zuerst die Zwischenablage geleert und dann das Bild in selbiege kopiert. Der Nachteil an dieser Methode ist das wenn das Fenster in dem das Livebild der Webcam abläuft nich im Vordergrund ist, das gespeicherte bild nichtmehr aktuell ist.
[color=blue]
Hat jemand eine idee wie man das Speichern des bildes ohne Clipboard realisieren kann?

Option Explicit
 
' benötigte Deklarationen
Private Declare Function capCreateCaptureWindow Lib "avicap32.dll" _
  Alias "capCreateCaptureWindowA" ( _
  ByVal lpszWindowName As String, _
  ByVal dwStyle As Long, _
  ByVal x As Long, _
  ByVal y As Long, _
  ByVal nWidth As Long, _
  ByVal nHeight As Long, _
  ByVal hWndParent As Long, _
  ByVal nID As Long) As Long
 
Private Const WS_CHILD = &H40000000
Private Const WS_VISIBLE = &H10000000
Private Const WM_USER = &H400
Private Const WM_CAP_START = &H400
Private Const WM_CAP_EDIT_COPY = (WM_CAP_START + 30)
Private Const WM_CAP_DRIVER_CONNECT = (WM_CAP_START + 10)
Private Const WM_CAP_SET_PREVIEWRATE = (WM_CAP_START + 52)
Private Const WM_CAP_SET_OVERLAY = (WM_CAP_START + 51)
Private Const WM_CAP_SET_PREVIEW = (WM_CAP_START + 50)
Private Const WM_CAP_DRIVER_DISCONNECT = (WM_CAP_START + 11)
 
Private Declare Function SendMessage Lib "user32" _
  Alias "SendMessageA" ( _
  ByVal hwnd As Long, _
  ByVal wMsg As Long, _
  ByVal wParam As Long, _
  lParam As Any) As Long
 
Private Preview_Handle As Long
Public Function CreateCaptureWindow( _
  hWndParent As Long, _
  Optional x As Long = 3, _
  Optional y As Long = 3, _
  Optional nWidth As Long = 340, _
  Optional nHeight As Long = 280, _
  Optional nCameraID As Long = 0) As Long
 
  Preview_Handle = capCreateCaptureWindow("Video", _
    WS_CHILD + WS_VISIBLE, x, y, _
    nWidth, nHeight, hWndParent, 1)
 
  SendMessage Preview_Handle, WM_CAP_DRIVER_CONNECT, nCameraID, 0
  SendMessage Preview_Handle, WM_CAP_SET_PREVIEWRATE, 30, 0
  SendMessage Preview_Handle, WM_CAP_SET_OVERLAY, 1, 0
  SendMessage Preview_Handle, WM_CAP_SET_PREVIEW, 1, 0
 
  CreateCaptureWindow = Preview_Handle
End Function
 
Public Sub Disconnect(nCaptureHandle As Long, _
  Optional nCameraID = 0)
 
  SendMessage nCaptureHandle, WM_CAP_DRIVER_DISCONNECT, _
    nCameraID, 0
End Sub
 
 
 
Public Sub [color=red]CapturePicture[/color](nCaptureHandle As Long, _
  picCapture As PictureBox)
 
  [color=red]
  Clipboard.Clear
  SendMessage nCaptureHandle, WM_CAP_EDIT_COPY, 0, 0
  picCapture.Picture = Clipboard.GetData
   [/color]
End Sub

Real programmer do not comment their code;
what?s hard to write should be hard to read

alle Nachrichten anzeigenGesamtübersicht  |  Zum Thema  |  Suchen

 ThemaViews  AutorDatum
Webcambild vernünftig speichern807Doom31.10.04 21:51

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