首页 新闻 会员 周边 捐助

directshowlib-2005拍照

0
悬赏园豆:20 [待解决问题]

请问一下,我下载的源码(vb.net)。为什么不能截图(黑屏)?

Public Function Click() As IntPtr      

Dim hr As Integer         ' get ready to wait for new image      

   m_PictureReady.Reset()      

   m_ipBuffer = Marshal.AllocCoTaskMem(Math.Abs(m_stride) * m_videoHeight)

        Try      

       m_WantOne = True

            ' If we are using a still pin, ask for a picture       

      If m_VidControl IsNot Nothing Then                 ' Tell the camera to send an image       

          hr = m_VidControl.SetMode(m_pinStill, VideoControlFlags.Trigger)                 DsError.ThrowExceptionForHR(hr)        

     End If

            ' Start waiting        

     If Not m_PictureReady.WaitOne(9000, False) Then       

          Throw New Exception("Timeout waiting to get picture")      

       End If      

   Catch         

    Marshal.FreeCoTaskMem(m_ipBuffer)        

     m_ipBuffer = IntPtr.Zero       

      Throw      

   End Try

        ' Got one      

   Return m_ipBuffer   

  End Function

视频显示正常,但调用截图时黑屏

 m_ip = cam.Click() Dim b As New Bitmap(cam.Width, cam.Height, 1920, PixelFormat.Format24bppRgb, m_ip)

ayshi的主页 ayshi | 初学一级 | 园豆:191
提问于:2016-11-29 21:34
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册