Click here to Skip to main content
15,897,273 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Opinions needed on "shared" keyword Pin
Eddy Vluggen13-Jan-12 6:34
professionalEddy Vluggen13-Jan-12 6:34 
QuestionDynamic dropdowns enable without post back Pin
byka12-Jan-12 6:31
byka12-Jan-12 6:31 
AnswerRe: Dynamic dropdowns enable without post back Pin
DannyStaten12-Jan-12 10:39
DannyStaten12-Jan-12 10:39 
QuestionChanging default value of a property of a control (DataGridView). Pin
priyamtheone12-Jan-12 3:16
priyamtheone12-Jan-12 3:16 
Answere: Changing default value of a property of a control (DataGridView). Pin
Simon_Whale12-Jan-12 3:41
Simon_Whale12-Jan-12 3:41 
QuestionRe: e: Changing default value of a property of a control (DataGridView). Pin
priyamtheone14-Jan-12 3:27
priyamtheone14-Jan-12 3:27 
AnswerRe: Changing default value of a property of a control (DataGridView). Pin
Wayne Gaylard12-Jan-12 3:47
professionalWayne Gaylard12-Jan-12 3:47 
QuestionDirectShowLib Adjust Camera Brightness Pin
ggoutam711-Jan-12 17:31
ggoutam711-Jan-12 17:31 
Hello,

- I am using DirectShowLib to acquire video from laptop camera and it can work well.
- I am trying to adjust the brightness by using the software but it does not work.
- As I move the track bar (tbBrightness), I want to change the brightness but it does not change.


The codes are as below :
VB
Imports DirectShowLib
Imports System.Runtime.InteropServices.ComTypes

    Private Sub GetSettings()
        Try
            Dim capDevices As DsDevice() = Nothing
            Dim CamDevice As DsDevice = Nothing
            Dim CamFilter As IBaseFilter = Nothing
            Dim CamControl As IAMCameraControl = Nothing
            Dim graphBuilder As IFilterGraph2 = CType(New FilterGraph, IFilterGraph2)
            '' ''Dim IID_IBaseFilter As Guid = New Guid("56a86895-0ad6-11ce-b03a-0020af0ba770")
            Dim nMin As Long = 0
            Dim nMax As Long = 0
            Dim nStep As Long = 0
            Dim nDefault As Long = 0
            Dim nFlags As Long = 0
            Dim hr As Int64 = 0

            capDevices = DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice)
            CamDevice = capDevices(0)

            If (CamDevice.Name = String.Empty) Then
                MsgBox("No video capture devices found!", MsgBoxStyle.OkOnly)
                Exit Sub
            End If

            '' ''CamDevice.Mon.BindToObject(Nothing, Nothing, IID_IBaseFilter, CamDevice) ' Causes "Specified cast is not valid." error
            hr = graphBuilder.AddSourceFilterForMoniker(CamDevice.Mon, Nothing, CamDevice.Name, CamFilter)
            CamControl = CType(CamFilter, IAMCameraControl)
            hr = CamControl.GetRange(VideoProcAmpProperty.Brightness, nMin, nMax, nStep, nDefault, nFlags)
            Me.tbBrightness.Minimum = nMin ' can get -50
            Me.tbBrightness.Maximum = nMax ' 50
            Me.tbBrightness.SmallChange = nStep ' 1
            Me.tbBrightness.Value = nDefault ' 0
            '' ''Me.tbBrightness.nFlags = nFlags ' 2
        Catch ex As Exception

        End Try
    End Sub

    Private Sub tbBrightness_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tbBrightness.Scroll
        Try
            Dim capDevices As DsDevice() = Nothing
            Dim CamDevice As DsDevice = Nothing
            Dim CamFilter As IBaseFilter = Nothing
            Dim CamControl As IAMCameraControl = Nothing
            Dim graphBuilder As IFilterGraph2 = CType(New FilterGraph, IFilterGraph2)
            Dim hr As Int64 = 0
            Dim nVal As Int64 = tbBrightness.Value

            capDevices = DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice)
            CamDevice = capDevices(0)

            hr = GraphBuilder.AddSourceFilterForMoniker(CamDevice.Mon, Nothing, CamDevice.Name, CamFilter)
            CamControl = CType(CamFilter, IAMCameraControl)
            hr = CamControl.Set(VideoProcAmpProperty.Brightness, nVal, CameraControlFlags.Auto)
        Catch ex As Exception

        End Try
    End Sub


I appreciate your guidance on fixing this problem.

cheers,
Goutam
QuestionVB2010 Serial Port Tutorial? Pin
JDBravo11-Jan-12 9:19
JDBravo11-Jan-12 9:19 
Answercheck this article out Pin
David Mujica11-Jan-12 10:02
David Mujica11-Jan-12 10:02 
GeneralRe: check this article out Pin
JDBravo11-Jan-12 10:11
JDBravo11-Jan-12 10:11 
AnswerRe: VB2010 Serial Port Tutorial? Pin
Luc Pattyn11-Jan-12 11:02
sitebuilderLuc Pattyn11-Jan-12 11:02 
GeneralRe: VB2010 Serial Port Tutorial? Pin
JDBravo11-Jan-12 11:48
JDBravo11-Jan-12 11:48 
AnswerRe: VB2010 Serial Port Tutorial? Pin
Luc Pattyn11-Jan-12 12:09
sitebuilderLuc Pattyn11-Jan-12 12:09 
GeneralRe: VB2010 Serial Port Tutorial? Pin
JDBravo12-Jan-12 4:15
JDBravo12-Jan-12 4:15 
GeneralRe: VB2010 Serial Port Tutorial? Pin
JDBravo12-Jan-12 6:19
JDBravo12-Jan-12 6:19 
GeneralRe: VB2010 Serial Port Tutorial? Pin
Simon_Whale12-Jan-12 6:26
Simon_Whale12-Jan-12 6:26 
GeneralRe: VB2010 Serial Port Tutorial? Pin
JDBravo12-Jan-12 6:38
JDBravo12-Jan-12 6:38 
AnswerRe: VB2010 Serial Port Tutorial? Pin
Luc Pattyn12-Jan-12 6:30
sitebuilderLuc Pattyn12-Jan-12 6:30 
GeneralRe: VB2010 Serial Port Tutorial? Pin
JDBravo12-Jan-12 6:46
JDBravo12-Jan-12 6:46 
GeneralRe: VB2010 Serial Port Tutorial? Pin
Luc Pattyn12-Jan-12 6:57
sitebuilderLuc Pattyn12-Jan-12 6:57 
GeneralRe: VB2010 Serial Port Tutorial? Pin
JDBravo12-Jan-12 7:17
JDBravo12-Jan-12 7:17 
GeneralRe: VB2010 Serial Port Tutorial? Pin
JDBravo13-Jan-12 6:11
JDBravo13-Jan-12 6:11 
AnswerRe: VB2010 Serial Port Tutorial? Pin
Luc Pattyn13-Jan-12 6:58
sitebuilderLuc Pattyn13-Jan-12 6:58 
AnswerRe: VB2010 Serial Port Tutorial? Pin
JDBravo13-Jan-12 10:39
JDBravo13-Jan-12 10:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.