dcsimg
Results 1 to 6 of 6

Thread: cam

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2016
    Posts
    55

    cam

    Hi anyone

    i have code for caption cam... now is my problem... when i minimize the windows or make the form invisible the cam caption stop
    know someone how i can let it caption when the form is minimize or invisible

    Here is my code

    Module
    Code:
    Public Const WS_CHILD As Long = &H40000000
    Public Const WS_VISIBLE As Long = &H10000000
    
    
    Public Const WM_USER As Long = &H400
    Public Const WM_CAP_START As Long = WM_USER
    
    
    Public Const WM_CAP_DRIVER_CONNECT As Long = WM_CAP_START + 10
    Public Const WM_CAP_DRIVER_DISCONNECT As Long = WM_CAP_START + 11
    Public Const WM_CAP_SET_PREVIEW As Long = WM_CAP_START + 50
    Public Const WM_CAP_SET_PREVIEWRATE As Long = WM_CAP_START + 52
    Public Const WM_CAP_DLG_VIDEOFORMAT As Long = WM_CAP_START + 41
    Public Const WM_CAP_FILE_SAVEDIB As Long = WM_CAP_START + 25
    
    Public Declare Function capCreateCaptureWindow _
        Lib "avicap32.dll" Alias "capCreateCaptureWindowA" _
             (ByVal lpszWindowName As String, ByVal dwStyle As Long _
            , ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long _
            , ByVal nHeight As Long, ByVal hwndParent As Long _
            , ByVal nID As Long) As Long
    
    Public Declare Function SendMessage Lib "user32" _
        Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long _
            , ByVal wParam As Long, ByRef lParam As Any) As Long
    form class code
    Code:
    Dim hCap As Long
    Private Sub cmd4_Click()
    Dim sFileName As String
        Call SendMessage(hCap, WM_CAP_SET_PREVIEW, CLng(False), 0&)
        With CDialog
            .CancelError = True
            .Flags = cdlOFNPathMustExist Or cdlOFNOverwritePrompt
            .Filter = "Bitmap Picture(*.bmp)|*.bmp|JPEG Picture(*.jpg)|*.jpg|All Files|*.*"
            .ShowSave
            sFileName = .FileName
        End With
        Call SendMessage(hCap, WM_CAP_FILE_SAVEDIB, 0&, ByVal CStr(sFileName))
    DoFinally:
        Call SendMessage(hCap, WM_CAP_SET_PREVIEW, CLng(True), 0&)
    End Sub
    
    
    Private Sub Cmd3_Click()
    Dim temp As Long
    temp = SendMessage(hCap, WM_CAP_DRIVER_DISCONNECT, 0&, 0&)
    End Sub
    
    
    Private Sub Cmd1_Click()
    hCap = capCreateCaptureWindow("Take a Camera Shot", WS_CHILD Or WS_VISIBLE, 0, 0, PicWebCam.Width, PicWebCam.Height, PicWebCam.hWnd, 0)
        If hCap <> 0 Then
            Call SendMessage(hCap, WM_CAP_DRIVER_CONNECT, 0, 0)
            Call SendMessage(hCap, WM_CAP_SET_PREVIEWRATE, 66, 0&)
            Call SendMessage(hCap, WM_CAP_SET_PREVIEW, CLng(True), 0&)
        End If
    End Sub
    
    
    Private Sub Cmd2_Click()
    Dim temp As Long
    temp = SendMessage(hCap, WM_CAP_DLG_VIDEOFORMAT, 0&, 0&)
    End Sub
    
    
    Private Sub Form_Load()
    cmd1.Caption = "Start &Cam"
    cmd2.Caption = "&Format Cam"
    cmd3.Caption = "&Close Cam"
    cmd4.Caption = "&Save Image"
    End Sub
    Thanks in advance

  2. #2
    Lively Member
    Join Date
    Apr 2015
    Posts
    120

    Re: cam

    Your OS is win-XP or Vista and above ?

    If its XP then , at least 1 pixel of the capture window has to be visible.

    So , instand of making it invisible , place it out of the screen , letting 1 pixel (or 1 row or column of pixels ) visible.

  3. #3

    Thread Starter
    Member
    Join Date
    Sep 2016
    Posts
    55

    Re: cam

    Hi jackB

    The program work good... only when i minimize the program or make the form invisible then the cam stop

    i have windows 10....

    it is not the pixel... but thanks for your answer

    Have a nice day JackB

  4. #4
    Hyperactive Member
    Join Date
    Oct 2016
    Posts
    369

    Re: cam

    The answer is no

  5. #5

    Re: cam

    Quote Originally Posted by I Love VB6 View Post
    The answer is no
    made it short and simple

  6. #6

    Thread Starter
    Member
    Join Date
    Sep 2016
    Posts
    55

    Re: cam

    clever of you... is that only what you know...

    it is possible....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width