Results 1 to 6 of 6

Thread: Variable Not Being Set.. - Resolved

Threaded View

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Dec 2003
    Posts
    4,787

    Resolved Variable Not Being Set.. - Resolved

    Ok i'm working on a Web Cam Class to get me going in .Net really.

    I've hit a slight problem, when the user starts previewing the camera and all goes succesful I set a boolean variable to True (IRunning) so that if they click start again the routine will exit if iRunning is true. For some strange reason this isnt happening, i've spent an hour or so playing with it, here is the code.. and i've attacthed the app incase you need it.

    VB Code:
    1. Public Sub initCam(ByVal parentH As Integer)
    2.         frmViewer = New frmMain
    3.         MessageBox.Show(Me.iRunning) 'dubug purpose
    4.  
    5.         If Me.iRunning = True Then 'not working....
    6.             MessageBox.Show("Camera Is Already Running")
    7.             Exit Sub
    8.         Else
    9.  
    10.             hHwnd = capCreateCaptureWindowA(iDevice, WS_VISIBLE Or WS_CHILD, 0, 0, 480, 360, parentH, 0)
    11.  
    12.  
    13.             If setCam() = False Then
    14.                 MessageBox.Show("Error setting Up Camera")
    15.             End If
    16.         End If
    17.     End Sub
    18.  
    19.  
    20.     Private Function setCam() As Boolean
    21.         If SendMessage(hHwnd, WM_CAP_DRIVER_CONNECT, iDevice, 0) Then
    22.             SendMessage(hHwnd, WM_CAP_SET_PREVIEWRATE, CamFrameRate, 0)
    23.             SendMessage(hHwnd, WM_CAP_SET_PREVIEW, True, 0)
    24.             Me.iRunning = True ' here set to true....
    25.             Return True
    26.         Else
    27.             Me.iRunning = False
    28.             Return False
    29.         End If
    30.     End Function

    Any help or guidence on this? am i using variables incorrectly?
    Last edited by Pino; Jun 4th, 2005 at 03:42 PM.

Posting Permissions

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



Click Here to Expand Forum to Full Width