vb@rchiv
VB Classic
VB.NET
ADO.NET
VBA
C#
vb@rchiv Offline-Reader - exklusiv auf der vb@rchiv CD Vol.4  
 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

Suche Visual-Basic Code
Re: Bilder speichern 
Autor: edmached
Datum: 15.08.07 10:43

Hi Mishka,

danke für dein schnelle Antwort.

Der Quellcode dazu, ein Bild von der Kamera zu fangen lautet :

Für den Modul
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 = 0, _
  Optional y As Long = 0, _
  Optional nWidth As Long = 320, _
  Optional nHeight As Long = 240, _
  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 CapturePicture(nCaptureHandle As Long, _
  picCapture As PictureBox)
 
  Clipboard.Clear
  SendMessage nCaptureHandle, WM_CAP_EDIT_COPY, 0, 0
  picCapture.Picture = Clipboard.GetData
End Sub
 
 
 
 
Public Sub Disconnect(nCaptureHandle As Long, _
  Optional nCameraID = 0)
 
  SendMessage nCaptureHandle, WM_CAP_DRIVER_DISCONNECT, _
    nCameraID, 0
End Sub
Für die Form
Option Explicit
 
Dim Video_Handle As Long
 
 
Private Sub Form_Load()
  Picture1.Visible = False
  Video_Handle = CreateCaptureWindow(Me.hwnd)
End Sub
 
 
Private Sub Save_Click()
  CapturePicture Video_Handle, Picture1
  SavePicture Picture1.Picture, _
    "Z:\Praktikanten\Phasue\VB6\Webcam_Bilder\Test.bmp"
 
End Sub
 
 
Private Sub Beenden_Click()
End
End Sub
Das Ganze beinhaltet ein PictureBox und 2 CommandButton

werde gleich mal dein Tips ausprobieren.

Danke nochmal
alle Nachrichten anzeigenGesamtübersicht  |  Zum Thema  |  Suchen

 ThemaViews  AutorDatum
Bilder speichern3.016edmached15.08.07 09:55
Re: Bilder speichern1.282Mishka Jok15.08.07 10:12
Re: Bilder speichern1.186Mishka Jok15.08.07 10:13
Re: Bilder speichern1.216edmached15.08.07 10:43
Re: Bilder speichern1.121edmached15.08.07 10:54
Re: Bilder speichern1.089Mishka Jok15.08.07 12:44
Re: Bilder speichern1.021edmached15.08.07 13:32
Re: Bilder speichern1.017Mishka Jok15.08.07 15:11
Re: Bilder speichern1.021edmached15.08.07 15:48
Re: Bilder speichern972Mishka Jok15.08.07 15:50
Re: Bilder speichern978edmached15.08.07 15:57
Re: Bilder speichern938Mishka Jok15.08.07 16:00
Re: Bilder speichern958edmached15.08.07 16:00
Re: Bilder speichern959Mishka Jok15.08.07 16:03
Re: Bilder speichern1.004Mishka Jok15.08.07 16:06
Re: Bilder speichern953Mishka Jok15.08.07 16:09
Re: Bilder speichern1.046edmached15.08.07 16:23
Re: Bilder speichern1.076Mishka Jok15.08.07 16:33
Re: Bilder speichern995edmached17.08.07 10:29

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