Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

API capGetDriverDescriptionA not "Streaming ok" Windows Vista 64b

Status
Not open for further replies.

wakkara

Programmer
Jun 15, 2005
31
0
6
MX
Hi there

I have developed an app on vb6 that was running on Win Xp and on Windows Vista Business, and on both the Streaming of a WebCam was
great.

Now the company wich hired for the developement is changing the Os to Windows Vista Ultimate and some Windows 7, and as far i have seen, is not streaming on the picture box as it should (Its always black) As for Windows 7 have tried the code jet.

Now. My Starting Point code was one posted by strongm on this forum which basiclly was structured this way.

'******************Declare*********************************
Const WM_CAP As Integer = &H400

Const WM_CAP_DRIVER_CONNECT As Long = WM_CAP + 10
Const WM_CAP_DRIVER_DISCONNECT As Long = WM_CAP + 11
Const WM_CAP_EDIT_COPY As Long = WM_CAP + 30

Const WM_CAP_SET_PREVIEW As Long = WM_CAP + 50
Const WM_CAP_SET_PREVIEWRATE As Long = WM_CAP + 52
Const WM_CAP_SET_SCALE As Long = WM_CAP + 53
Const WS_CHILD As Long = &H40000000
Const WS_VISIBLE As Long = &H10000000
Const SWP_NOMOVE As Long = &H2
Const SWP_NOSIZE As Integer = 1
Const SWP_NOZORDER As Integer = &H4
Const HWND_BOTTOM As Integer = 1

Dim iDevice As Long ' Current device ID
Dim hHwnd As Long ' Handle to preview window

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 Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal CX As Long, ByVal CY As Long, ByVal wFlags As Long) As Long
Private Declare Function DestroyWindow Lib "user32" (ByVal hndw As Long) As Boolean
Private Declare Function capCreateCaptureWindowA Lib "avicap32.dll" (ByVal lpszWindowName As String, ByVal dwStyle As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Integer, ByVal hWndParent As Long, ByVal nID As Long) As Long
Private Declare Function capGetDriverDescriptionA Lib "avicap32.dll" (ByVal wDriver As Long, ByVal lpszName As String, ByVal cbName As Long, ByVal lpszVer As String, ByVal cbVer As Long) As Boolean
'******************Declare*********************************




******************procedures*******************************
Private Sub OpenPreviewWindow()

' Open Preview window in picturebox
hHwnd = capCreateCaptureWindowA(iDevice, WS_VISIBLE Or WS_CHILD, 0, 0, 176, 144, picCapture.hwnd, 0)

' Connect to device
If SendMessage(hHwnd, WM_CAP_DRIVER_CONNECT, iDevice, 0) Then

'Set the preview scale
SendMessage hHwnd, WM_CAP_SET_SCALE, True, 0

'Set the preview rate in milliseconds
SendMessage hHwnd, WM_CAP_SET_PREVIEWRATE, 66, 0

'Start previewing the image from the camera
SendMessage hHwnd, WM_CAP_SET_PREVIEW, True, 0

' Resize window to fit in picturebox
SetWindowPos hHwnd, HWND_BOTTOM, 0, 0, picCapture.Width, picCapture.Height, SWP_NOMOVE Or SWP_NOZORDER

Else

' Error connecting to device close window
DestroyWindow hHwnd

End If
End Sub

Public Sub ClosePreviewWindow()
' Disconnect from device
SendMessage hHwnd, WM_CAP_DRIVER_DISCONNECT, iDevice, 0

' close window
DestroyWindow hHwnd
End Sub

******************procedures*******************************

******************usage***********************
Private Sub ChkActivarCam_Click()
If ChkActivarCam.Value = 1 Then
If ComboListCamaras.ListCount > 0 Then
ComboListCamaras.ListIndex = 0
End If
iDevice = ComboListCamaras.ListIndex
OpenPreviewWindow
ButCapturaryGuardar.Enabled = True
Else
ClosePreviewWindow
ButCapturaryGuardar.Enabled = False
End If
End Sub******************usage***********************


so, Is there a way to make the procedure to refresh the PictureBox, I Mean, i think the API uses the Clipboard to refresh the PictureBox?
Isnt that right?
What am i missing.

Thx in advanced.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top