Click here to Skip to main content
15,920,632 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: how to change vb98 project to vb.net2005 project Pin
Paritos1-Mar-06 22:56
Paritos1-Mar-06 22:56 
Questioncopy macro into xls file Pin
lonely_life1-Mar-06 21:01
lonely_life1-Mar-06 21:01 
QuestionTreeview problem in vb.net Pin
pankajgarg121-Mar-06 20:25
pankajgarg121-Mar-06 20:25 
AnswerRe: Treeview problem in vb.net Pin
Dave Kreskowiak2-Mar-06 7:42
mveDave Kreskowiak2-Mar-06 7:42 
QuestionOpen a file when it is double clicked Pin
Chatura Dilan1-Mar-06 20:19
Chatura Dilan1-Mar-06 20:19 
AnswerRe: Open a file when it is double clicked Pin
noshaba mariam1-Mar-06 21:23
noshaba mariam1-Mar-06 21:23 
AnswerRe: Open a file when it is double clicked Pin
J4amieC1-Mar-06 21:53
J4amieC1-Mar-06 21:53 
GeneralRe: Open a file when it is double clicked Pin
Chatura Dilan2-Mar-06 1:12
Chatura Dilan2-Mar-06 1:12 
GeneralRe: Open a file when it is double clicked Pin
J4amieC2-Mar-06 1:16
J4amieC2-Mar-06 1:16 
GeneralRe: Open a file when it is double clicked Pin
Chatura Dilan2-Mar-06 14:13
Chatura Dilan2-Mar-06 14:13 
GeneralRe: Open a file when it is double clicked Pin
Omar Mallat2-Mar-06 2:02
professionalOmar Mallat2-Mar-06 2:02 
GeneralRe: Open a file when it is double clicked Pin
Chatura Dilan2-Mar-06 14:06
Chatura Dilan2-Mar-06 14:06 
QuestionHow to get the clients IP address using TcpClient in VB.Net Pin
Maher Abu Zer1-Mar-06 20:19
professionalMaher Abu Zer1-Mar-06 20:19 
AnswerRe: How to get the clients IP address using TcpClient in VB.Net Pin
Dave Kreskowiak2-Mar-06 5:35
mveDave Kreskowiak2-Mar-06 5:35 
AnswerRe: How to get the clients IP address using TcpClient in VB.Net Pin
Maher Abu Zer2-Mar-06 6:34
professionalMaher Abu Zer2-Mar-06 6:34 
GeneralRe: How to get the clients IP address using TcpClient in VB.Net Pin
Dave Kreskowiak2-Mar-06 7:37
mveDave Kreskowiak2-Mar-06 7:37 
QuestionTreeeview problem in vb.net Pin
pankajgarg121-Mar-06 20:09
pankajgarg121-Mar-06 20:09 
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

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.