Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

capSetVideoFormat - *** Urgent Help ***

 

Hi, I got a piece of code below it supposes to set the video format of a webcam....but it does not works....

 

can someone help me out here, I've been trying to get it working for a few days. It running with no error, but just not setting the format right.

 

Thk

 

 

----------------------Code----------------------------------

'API declaration

Declare Function SendMessageFormat Lib "USER32" Alias "SendMessageA" ( _

ByVal hWnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, _

ByRef lParam As Object) As Integer

 

 

Const WM_CAP_SET_VIDEOFORMAT As Integer = (WM_CAP_START + 45)

 

 

Private Structure RGBQUAD

Dim rgbBlue As Byte

Dim rgbGreen As Byte

Dim rgbRed As Byte

Dim rgbReserved As Byte

End Structure

 

Private Structure BITMAPINFOHEADER '40 bytes

Dim biSize As Long

Dim biWidth As Long

Dim biHeight As Long

Dim biPlanes As Integer

Dim biBitCount As Integer

Dim biCompression As Long

Dim biSizeImage As Long

Dim biXPelsPerMeter As Long

Dim biYPelsPerMeter As Long

Dim biClrUsed As Long

Dim biClrImportant As Long

End Structure

 

Private Structure BITMAPINFO

Dim bmiHeader As BITMAPINFOHEADER

Dim bmiColors As RGBQUAD

End Structure

 

 

 

Private Sub capSetFormat()

 

Dim bmi As BITMAPINFO

Dim wSize As Byte 'structure size

Dim test As Boolean

 

With bmi.bmiHeader

.biSize = 40

.biPlanes = 1

.biBitCount = 24

.biCompression = 0

.biClrUsed = 0

.biClrImportant = 0

.biSizeImage = (640 * 480) * 3

.biWidth = 640

.biHeight = 480

End With

 

SendMessageFormat(hWnd, WM_CAP_SET_VIDEOFORMAT, 40, bmi)

 

End Sub

 

------------------End code---------------------------------

  • *Experts*
Posted
You'll need to replace the Longs in the Structure definition with Integers, and the Integers with Shorts. The sizes of the data-types have shifted in .NET to comply with those in C++.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...