Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
[blue]Const WM_USER As Integer = &H400
Const WM_CAP_GET_VIDEOFORMAT = WM_USER + 44
Const WM_CAP_SET_VIDEOFORMAT = WM_USER + 45
Private Type BITMAPINFOHEADER
biSize As Long
biWidth As Long
biHeight As Long
biPlanes As Integer
biBitCount As Integer
biCompression As Long
biSizeImage As Long
biXPelsPerMeter As Long
biYPelsPerMeter As Long
biClrUsed As Long
biClrImportant As Long
End Type
Private Type RGBQUAD
rgbBlue As Byte
rgbGreen As Byte
rgbRed As Byte
rgbReserved As Byte
End Type
Private Type BITMAPINFO
bmiHeader As BITMAPINFOHEADER
bmiColors As RGBQUAD
End Type
' Let's play around with capture resolutions
' Remember that, no matter what resolution the camera is set to the image will be strectched
' to fit the preview window exactly - but do not worry, the actual capture will be at the selected
' resolution. In this example, we can see this by grabbing a single snapshot from the preview window
' and blitting it into a non-strecthed window; i.e. the Command1_Click code here
Dim myBMI As BITMAPINFO
Dim result As Long
Dim size As Long
result = SendMessage(mCaphWnd, WM_CAP_GET_VIDEOFORMAT, 0&, ByVal 0&) ' get real size of structure into result (as there may be additional data after the documented members)
SendMessage mCaphWnd, WM_CAP_GET_VIDEOFORMAT, result, myBMI ' OK , now get current settings into structure (this means we will only have to set the members we want rather than ALL the members)
' Make sure you choose a resolution the webcam supports
myBMI.bmiHeader.biWidth = 160 '320
myBMI.bmiHeader.biHeight = 120 '240
myBMI.bmiHeader.biSizeImage = myBMI.bmiHeader.biHeight * myBMI.bmiHeader.biWidth * 3
SendMessage mCaphWnd, WM_CAP_SET_VIDEOFORMAT, result, myBMI[/blue]