Click here to Skip to main content
15,887,485 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Treeeview problem in vb.net Pin
Dave Kreskowiak2-Mar-06 5:08
mveDave Kreskowiak2-Mar-06 5:08 
Questioncreating multiple webcharts based upon query ID Pin
uglyeyes1-Mar-06 19:25
uglyeyes1-Mar-06 19:25 
AnswerRe: creating multiple webcharts based upon query ID Pin
Dave Kreskowiak2-Mar-06 4:50
mveDave Kreskowiak2-Mar-06 4:50 
Questioncode for thinning or skeletonization in vb Pin
swap_1231-Mar-06 19:18
swap_1231-Mar-06 19:18 
AnswerRe: code for thinning or skeletonization in vb Pin
Dave Kreskowiak2-Mar-06 4:20
mveDave Kreskowiak2-Mar-06 4:20 
QuestionVB Image Comparison Pin
Russ72841-Mar-06 16:36
Russ72841-Mar-06 16:36 
AnswerRe: VB Image Comparison Pin
progload1-Mar-06 19:46
progload1-Mar-06 19:46 
GeneralRe: VB Image Comparison Pin
Russ72842-Mar-06 14:51
Russ72842-Mar-06 14:51 
Here is my module for capturing the image, I believe it is capturing it in bitmap.

Module modCam

    Const WM_CAP As Short = &H400S

    Const WM_CAP_DRIVER_CONNECT As Integer = WM_CAP + 10
    Const WM_CAP_DRIVER_DISCONNECT As Integer = WM_CAP + 11
    Const WM_CAP_EDIT_COPY As Integer = WM_CAP + 30

    Const WM_CAP_SET_PREVIEW As Integer = WM_CAP + 50
    Const WM_CAP_SET_PREVIEWRATE As Integer = WM_CAP + 52
    Const WM_CAP_SET_SCALE As Integer = WM_CAP + 53
    Const WS_CHILD As Integer = &H40000000
    Const WS_VISIBLE As Integer = &H10000000
    Const SWP_NOMOVE As Short = &H2S
    Const SWP_NOSIZE As Short = 1
    Const SWP_NOZORDER As Short = &H4S
    Const HWND_BOTTOM As Short = 1

    Dim hHwnd As Integer ' Handle to preview window

    Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
        (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, _
        <MarshalAs(UnmanagedType.AsAny)> ByVal lParam As Object) As Integer

    Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos" (ByVal hwnd As Integer, _
        ByVal hWndInsertAfter As Integer, ByVal x As Integer, ByVal y As Integer, _
        ByVal cx As Integer, ByVal cy As Integer, ByVal wFlags As Integer) As Integer

    Declare Function DestroyWindow Lib "user32" (ByVal hndw As Integer) As Boolean

    Declare Function capCreateCaptureWindowA Lib "avicap32.dll" _
        (ByVal lpszWindowName As String, ByVal dwStyle As Integer, _
        ByVal x As Integer, ByVal y As Integer, ByVal nWidth As Integer, _
        ByVal nHeight As Short, ByVal hWndParent As Integer, _
        ByVal nID As Integer) As Integer

    Declare Function capGetDriverDescriptionA Lib "avicap32.dll" (ByVal wDriver As Short, _
        ByVal lpszName As String, ByVal cbName As Integer, ByVal lpszVer As String, _
        ByVal cbVer As Integer) As Boolean

    Public Sub SaveImage()
        Dim data As IDataObject
        Dim bmap As Image
        data = Clipboard.GetDataObject()
        If data.GetDataPresent(GetType(System.Drawing.Bitmap)) Then
            bmap = CType(data.GetData(GetType(System.Drawing.Bitmap)), Image)
            frmMain.imgCapture.Image = bmap
            bmap.Save("target.bmp", Imaging.ImageFormat.Bmp)
        End If
    End Sub

    Public Sub ToClipBoard()
        SendMessage(hHwnd, WM_CAP_EDIT_COPY, 0, 0)
    End Sub

    Public Sub LoadDeviceList()
        Dim strName As String = Space(100)
        Dim strVer As String = Space(100)
        Dim bReturn As Boolean
        Dim x As Integer = 0
        Do
            bReturn = capGetDriverDescriptionA(x, strName, 100, strVer, 100)
            If bReturn Then frmMain.lstDevices.Items.Add(strName.Trim)
            x += 1
        Loop Until bReturn = False
    End Sub

    Public Sub OpenPreviewWindow(ByVal iDevice As Integer)
        Dim iHeight As Integer = frmMain.imgCapture.Height
        Dim iWidth As Integer = frmMain.imgCapture.Width
        hHwnd = capCreateCaptureWindowA(iDevice, WS_VISIBLE Or WS_CHILD, 0, 0, 640, _
            480, frmMain.imgCapture.Handle.ToInt32, 0)
        If SendMessage(hHwnd, WM_CAP_DRIVER_CONNECT, iDevice, 0) Then   ' Connect to device
            SendMessage(hHwnd, WM_CAP_SET_SCALE, True, 0)               'Set the preview scale
            SendMessage(hHwnd, WM_CAP_SET_PREVIEWRATE, 1, 0)            'Set the preview rate in milliseconds
            SendMessage(hHwnd, WM_CAP_SET_PREVIEW, True, 0)             'Start previewing the image from the camera
            SetWindowPos(hHwnd, HWND_BOTTOM, 0, 0, frmMain.imgCapture.Width, frmMain.imgCapture.Height, _
                    SWP_NOMOVE Or SWP_NOZORDER)                         'Resize window to fit in picturebox

        Else
            DestroyWindow(hHwnd)
        End If
    End Sub

    Public Sub ClosePreviewWindow(ByVal iDevice As Integer)
        SendMessage(hHwnd, WM_CAP_DRIVER_DISCONNECT, iDevice, 0)
        DestroyWindow(hHwnd)
    End Sub
End Module

GeneralRe: VB Image Comparison Pin
progload2-Mar-06 17:10
progload2-Mar-06 17:10 
GeneralRe: VB Image Comparison Pin
Russ72843-Mar-06 3:17
Russ72843-Mar-06 3:17 
QuestionComparing two large files Pin
Klazen1-Mar-06 15:44
Klazen1-Mar-06 15:44 
AnswerRe: Comparing two large files Pin
Dave Kreskowiak2-Mar-06 3:57
mveDave Kreskowiak2-Mar-06 3:57 
GeneralRe: Comparing two large files Pin
Klazen2-Mar-06 12:46
Klazen2-Mar-06 12:46 
QuestionFile Properties - mp3 Pin
united181-Mar-06 14:45
united181-Mar-06 14:45 
AnswerRe: File Properties - mp3 Pin
Klazen1-Mar-06 16:01
Klazen1-Mar-06 16:01 
GeneralRe: File Properties - mp3 Pin
united181-Mar-06 17:50
united181-Mar-06 17:50 
GeneralRe: File Properties - mp3 Pin
united184-Mar-06 7:44
united184-Mar-06 7:44 
GeneralRe: File Properties - mp3 Pin
Klazen4-Mar-06 10:38
Klazen4-Mar-06 10:38 
GeneralRe: File Properties - mp3 Pin
united184-Mar-06 20:35
united184-Mar-06 20:35 
QuestionChanges after Binding Data Pin
xoxoxoxoxoxox1-Mar-06 14:38
xoxoxoxoxoxox1-Mar-06 14:38 
AnswerRe: Changes after Binding Data Pin
Dave Kreskowiak2-Mar-06 4:10
mveDave Kreskowiak2-Mar-06 4:10 
QuestionHow to set a directory hidden? Pin
cylix20001-Mar-06 14:29
cylix20001-Mar-06 14:29 
AnswerRe: How to set a directory hidden? Pin
Klazen1-Mar-06 15:56
Klazen1-Mar-06 15:56 
GeneralRe: How to set a directory hidden? Pin
cylix20001-Mar-06 22:21
cylix20001-Mar-06 22:21 
AnswerRe: How to set a directory hidden? Pin
Omar Mallat2-Mar-06 2:22
professionalOmar Mallat2-Mar-06 2:22 

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.