Starting with the code I posted recently to display a webcam, I'd like to put a button on top of the video. But the video always writes over any control I put on the dialog.
Thoughts on whether I can have a control show on top of the direct show video?
With this example, you can see that the button is not visible.
Thoughts on whether I can have a control show on top of the direct show video?
With this example, you can see that the button is not visible.
Code:
'Compilable Example: (Jose Includes) #Compile Exe #Dim All %Unicode = 1 #Include "Win32API.inc" #Include Once "dshow.inc" %IDC_Button = 500 Global hDlg, hLst As Dword Global pGraph As IGraphBuilder 'Filter Graph Manager Global pBuild As ICaptureGraphBuilder2 'Capture Graph Builder Global pSysDevEnum As ICreateDevEnum 'enumeration object Global pEnumCat As IEnumMoniker Global pMoniker As IMoniker 'contains information about other objects Global pceltFetched As Dword Global pCap As IBaseFilter 'Video capture filter Global pControl As IMediaControl Global pWindow As IVideoWindow 'Display Window Function PBMain() As Long Dialog New Pixels, 0, "Camera and Toolbar",,,640,480, %WS_OverlappedWindow Or %WS_ClipChildren Or %WS_ClipSiblings To hDlg Control Add Button, hDlg, %IDC_Button, "Test", 100,100,100,25 Dialog Show Modal hDlg Call DlgProc End Function CallBack Function DlgProc() As Long Select Case Cb.Msg Case %WM_InitDialog DisplayFirstCamera End Select End Function Sub DisplayFirstCamera pGraph = NewCom ClsId $CLSID_FilterGraph 'filter graph pBuild = NewCom ClsId $CLSID_CaptureGraphBuilder2 'capture graph builder pSysDevEnum = NewCom ClsId $CLSID_SystemDeviceEnum 'enumeration object If pSysDevEnum.CreateClassEnumerator($CLSID_VideoInputDeviceCategory, pEnumCat, 0) <> %S_Ok Then Exit Sub pEnumCat.next(1, pMoniker, pceltFetched) 'cycle through monikders pMoniker.BindToObject(Nothing, Nothing, $IID_IBaseFilter, pCap) 'create device filter for the chosen device pGraph.AddFilter(pCap,"First Camera") 'add chosen device filter to the filter graph pBuild.SetFilterGraph(pGraph) 'initialize pBuild pBuild.RenderStream $Pin_Category_Preview, $MediaType_Video, pCap, Nothing, Nothing 'render the live source pWindow = pGraph : pWindow.Owner = hDlg : pWindow.WindowStyle = %WS_Child Or %WS_ClipChildren 'video window settings pWindow.SetWindowPosition(0,0,640,480) pControl = pGraph pControl.Run End Sub
Comment