Hallo,
Ich habe mal das Beispielscript unter VB angefügt, ist aber auch in Delphi, C++, VC und HTML (Java) verfügbar. Kann man direkt auf der Seite bei Hauppage unter Treiber herunterladen passend zur eigenen Karte.
Code:
'/*******************************************************************************
'*
'* HH HH CCCC WW WW
'* HH HH CCCCCC WW WW
'* HH HH CCC WW WW
'* HHHHHH CCC WW WWW WW
'* HH HH CCC WW WW WW WW
'* HH HH CCCCCC WWWW WWWW
'* HH HH CCCC WW WW
'*
'* Copyright (C) 1994-1998
'* Hauppauge Computer Works, Inc
'* 91 Cabot Court
'* Hauppauge, NY 11788
'* 516 / 434-1600
'*
'*******************************************************************************/
'********************************************************************************
'*
'* Hauppauge Computer Works WinTV OCX Sample Application
'* for use with hcwWinTV.ocx
'*
'********************************************************************************
' This sample application is to show how to use the Hauppauge WinTV OCX in Visual
' Basic. Be sure hcwWinTV.ocx is installed and registered.
' This sample application is assuming the user's WinTV board has both a Tuner and
' a Composite video input, actual application should detect the hardware avalibility
' first, and deals with the inputs accordingly.
' This application is just a simple example, it may not be pratical, or complete.
' Compiled and tested in Visual Basic 6.0.
Private Sub cmdChanExplorer_Click()
' bring up the channel explorer dialog
hcwWinTVocx1.ShowChannelExplorer
End Sub
Private Sub cmdChannelDown_Click()
' tune down the channel
hcwWinTVocx1.ChannelDown
End Sub
Private Sub cmdChannelUp_Click()
' tune up the channel
hcwWinTVocx1.ChannelUp
End Sub
Private Sub cmdMotionCapFormat_Click()
' bring up the Motion Capture Format config dialog
hcwWinTVocx1.MotionCapFormat
End Sub
Private Sub cmdMotionCapSetup_Click()
'bring up the Motion Capture Setup Dialog
hcwWinTVocx1.MotionCapSetup
End Sub
Private Sub cmdMotionCapture_Click()
' Start the Motion Capture, a mouse click or hit the Esc key will stop the capturing
hcwWinTVocx1.MotionCapture
End Sub
Private Sub cmdMotionPalyback_Click()
' play back the AVI file captured by the program
hcwWinTVocx1.MotionPlayback
End Sub
Private Sub cmdSaveToDisk_Click()
' this call display the "Print..." dialog, and
' save the image to a disk file
Call hcwWinTVocx1.SaveToDisk
End Sub
Private Sub cmdFreeze_Click()
' freeze or unfreeze the video according to its
' previous status
Call hcwWinTVocx1.ToggleFreezeVideo
End Sub
Private Sub cmdShowAudioControlBox_Click()
' show the audio config dialog box
Call hcwWinTVocx1.ShowAudioControlBox
End Sub
Private Sub cmdShowColorControlBox_Click()
' show the color config dialog box
Call hcwWinTVocx1.ShowColorControlBox
End Sub
Private Sub cmdSnapshot_Click()
' do a 800*600 snapshot
hcwWinTVocx1.SnapShot (800)
End Sub
Private Sub cmdSurf_Click()
' do channel surfing, press the button again will stop the surfing.
If hcwWinTVocx1.SurfMode = False Then
hcwWinTVocx1.SurfStart
Else
hcwWinTVocx1.SurfEnd
End If
End Sub
Private Sub Command1_Click()
End Sub
Private Sub Form_Load()
' during the form load, we need to get some information
' from the winTV control, and adjust the display accordingly.
' enable the WinTV control
hcwWinTVocx1.Enabled = True
' determine the current video input source
Select Case hcwWinTVocx1.VideoSourceByType
Case hcwVideoSource_Tuner
optionTuner.Value = True
Case hcwVideoSource_Composite1, _
hcwVideoSource_Composite2, _
hcwVideoSource_Composite3
optionComposite.Value = True
Case Else
optionTuner.Value = False
optionComposite.Value = False
End Select
' determin the current volume level
SliderVolume.Value = hcwWinTVocx1.Volume
' determine the current Contrast and HSB level
sliderContrast.Value = hcwWinTVocx1.Contrast
sliderBrightness.Value = hcwWinTVocx1.Brightness
' determine the current Control Panel Position
optionToolBarPosition(hcwWinTVocx1.ToolBarPosition).Value = True
End Sub
Private Sub Form_Resize()
' if form is minimized, don't do anything
If frmAppSample.WindowState = 1 Then '1 - minimized
Exit Sub
End If
' limit the form size, be sure all the contents can be seen
If frmAppSample.ScaleWidth < Frame2.Width + 4000 Then
frmAppSample.Width = Frame2.Width + 4000
End If
If frmAppSample.ScaleHeight < Frame2.Height + Frame3.Height + Frame4.Height + Frame5.Height + 200 Then
frmAppSample.Height = Frame2.Height + Frame3.Height + Frame4.Height + Frame5.Height + 850
End If
' resize the video frame and OCX to follow the size of form
frameVideo.Left = Frame2.Width + 30
frameVideo.Top = 90
frameVideo.Width = frmAppSample.ScaleWidth - Frame2.Width - 30
frameVideo.Height = frmAppSample.ScaleHeight - 120
hcwWinTVocx1.Width = frameVideo.Width - 200
hcwWinTVocx1.Height = frameVideo.Height - 320
End Sub
Private Sub hcwWinTVocx1_HSBChanged(Contrast As Long, _
Hue As Long, _
Saturation As Long, _
Brightness As Long)
' adjust the sliders according to the new HSB levels
sliderContrast.Value = Contrast
sliderBrightness.Value = Brightness
End Sub
Private Sub hcwWinTVocx1_InputSourceChanged(InputSource As _
hcwWinTVControl.hcwVideoSource)
' adjust the input source option buttons according to the new source
If InputSource = hcwVideoSource_Tuner Then
optionTuner.Value = True
End If
If InputSource = hcwVideoSource_Composite1 Or _
InputSource = hcwVideoSource_Composite2 Or _
InputSource = hcwVideoSource_Composite3 Then
optionComposite.Value = True
End If
End Sub
Private Sub hcwWinTVocx1_VolumeChanged(Volume As Long)
' adjust the volume slider according to the new volume
SliderVolume.Value = Volume
End Sub
Private Sub menuAbout_Click()
' show the WinTV OCX about box
Call hcwWinTVocx1.ShowAboutBox
End Sub
Private Sub menuCCon_Click()
' Turn CC on.
If menuCCon.Checked Then
menuCCon.Checked = False
Else
menuCCon.Checked = True
End If
If hcwWinTVocx1.GetCCState = True Then
hcwWinTVocx1.ClosedCaption = menuCCon.Checked
Else
MyVar = MsgBox("Closed Caption Not Available!", 65, "WinTV Example") ' MyVar contains either 1 or 2,
End If
End Sub
Private Sub menuExit_Click()
' when exit the program, the OCX will terminate by itself,
' no need to take care of it
Unload frmAppSample
End Sub
Private Sub optionComposite_Click()
' switch the video input source to the first Composite input
hcwWinTVocx1.VideoSourceByType = hcwVideoSource_Composite1
End Sub
Private Sub optionToolBarPosition_Click(Index As Integer)
' set the ToolBarPostion
hcwWinTVocx1.ToolBarPosition = Index
End Sub
Private Sub optionTuner_Click()
' switch the video input source to the Tuner
hcwWinTVocx1.VideoSourceByType = hcwVideoSource_Tuner
End Sub
Private Sub SliderContrast_Scroll()
' adjust the picture Contrast by the slider value
hcwWinTVocx1.Contrast = sliderContrast.Value
End Sub
Private Sub sliderBrightness_Scroll()
' adjust the picture Brightness level by the slider value
hcwWinTVocx1.Brightness = sliderBrightness.Value
End Sub
Private Sub SliderVolume_Scroll()
' adjust the volume by the slider value
hcwWinTVocx1.Volume = SliderVolume.Value
End Sub
Grüsse Wolfgang
Lesezeichen