Webcam chat sub
I have written this VB6 code to capture video from a webcam and put it into Picture Box0.
It works perfectly all the time on Vista but on Windows 8.1 it runs perfectly the first time after boot-up but running it again after that it just fills Picture Box0 with black.
Settings options are available at the top left of the chat which allow you to customize your chat experience.
You will also note a number of drop down tabs throughout the chat which will give you further chat customizations.
There I started by trying to create the simplest VB6 program that I could to use Direct Show for webcam capture, and gradually attempted to add various refinements.
Hello dilettante I must start by thanking you so much for your help.
However that had video capabilities stripped out as of Windows Vista due to DRM concerns.Simply click a user name in the user list which has a cam icon to begin streaming their broadcast.Upgraded chat profiles on the chat service have the ability to view 6 broadcast streams simultaneously.I seems to be working fine with all my other projects. 'This code is in Module1Option Explicit Public Declare Function Send Message Lib "user32" Alias "Send Message A" (By Val hwnd As Long, By Val w Msg As Long, By Val w Param As Long, l Param As Any) As Long Public Declare Function cap Create Capture Window Lib "avicap32.dll" Alias "cap Create Capture Window A" (By Val lpsz Window Name As String, By Val dw Style As Long, By Val x As Long, By Val y As Long, By Val n Width As Long, By Val n Height As Long, By Val hwnd Parent As Long, By Val n ID As Long) As Long Public Const CONNECT As Long = 1034 Public Const DISCONNECT As Long = 1035 Public Const GET_FRAME As Long = 1084 Public Const COPY As Long = 1054 Public Const ws_visible = &H10000000 Public Const ws_child = &H40000000 Public Const WM_USER = 1024 Public Const WM_CAP_SET_PREVIEW = WM_USER 50 Public Const WM_CAP_SET_PREVIEWRATE = WM_USER 52 Public Const PREVIEWRATE = 30 Public m Cap Hwnd As Long 'This code is in Form1 Option Explicit Sub Form_Load() Set Up Capture Window End Sub Private Sub Set Up Capture Window() 'Setup a capture window ("Capture Window" can be any string) m Cap Hwnd = cap Create Capture Window("Capture Window", ws_child Or ws_visible, 0, 0, Picture0. Scale Height, Picture0.hwnd, 0) If (m Cap Hwnd 0) Then 'Connect to capture device Send Message m Cap Hwnd, CONNECT, 0, 0 'Make the video in Picture0 run in real time Send Message m Cap Hwnd, WM_CAP_SET_PREVIEW, 1, 0 Send Message m Cap Hwnd, WM_CAP_SET_PREVIEWRATE, PREVIEWRATE, 0 Else Msg Box "Unable to capture video.", vb Critical End If End Sub Private Sub Form_Unload(Cancel As Integer) 'The application is closing so tidy up!Send Message m Cap Hwnd, DISCONNECT, 0, 0 'Disconnect from capture source - if it is connected upon termination the program can become unstable End Sub This "black Avi Cap" problem seems to be very common but I have never seen any description of why it happens or what can be done about it.