Page 1 of 2 12 LastLast
Results 1 to 15 of 23
  1. #1
    Bombsaway707's Avatar
    Join Date
    Jun 2009
    Gender
    male
    Location
    Gym
    Posts
    8,799
    Reputation
    791
    Thanks
    4,004
    My Mood
    Amused

    Post [Leeched] Tutorial Using Webcams

    How to use a webcam in your programs...you will need:

    PictureBox
    Label
    4 x Buttons
    ListBox

    Now once you have them on your form, label them as follows:

    Label = "Double Click to start your webcam"
    Button1 = "Stop"
    Button2 = "Record"
    Button3 = "Save"
    Button4 = "Preview"
    It should look like this when you've put in all items listed above:


    OK now Copy and paste this code into your form.....
    Code:
    Imports System
    Imports System.IO
    Imports System.Runtime.InteropServices
    Imports Microsoft.Win32
    
    Public Class Form1
    Inherits System.Windows.Forms.Form
    
    Const WM_CAP_START = &H400S
    Const WS_CHILD = &H40000000
    Const WS_VISIBLE = &H10000000
    Const WM_CAP_DRIVER_CONNECT = WM_CAP_START + 10
    Const WM_CAP_DRIVER_DISCONNECT = WM_CAP_START + 11
    Const WM_CAP_EDIT_COPY = WM_CAP_START + 30
    Const WM_CAP_SEQUENCE = WM_CAP_START + 62
    Const WM_CAP_FILE_SAVEAS = WM_CAP_START + 23
    Const WM_CAP_SET_SCALE = WM_CAP_START + 53
    Const WM_CAP_SET_PREVIEWRATE = WM_CAP_START + 52
    Const WM_CAP_SET_PREVIEW = WM_CAP_START + 50
    Const SWP_NOMOVE = &H2S
    Const SWP_NOSIZE = 1
    Const SWP_NOZORDER = &H4S
    Const HWND_BOTTOM = 1
    '--The capGetDriverDescription function retrieves the version 
    ' description of the capture driver--
    Declare Function capGetDriverDescriptionA Lib"avicap32.dll" _
    (ByVal wDriverIndex As Short, _
    ByVal lpszName As String, ByVal cbName AsInteger, _
    ByVal lpszVer As String, _
    ByVal cbVer As Integer) AsBoolean
    
    '--The capCreateCaptureWindow function creates a capture window--
    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 hWnd As Integer, _
    ByVal nID As Integer) As Integer
    
    '--This function sends the specified message to a window or windows--
    Declare Function SendMessage Lib"user32"Alias"SendMessageA" _
    (ByVal hwnd As Integer, ByVal Msg As Integer, _
    ByVal wParam As Integer, _
    <MarshalAs(UnmanagedType.AsAny)> ByVal lParam As Object) As Integer
    
    '--Sets the position of the window relative to the screen buffer--
    Declare Function SetWindowPos Lib"user32"Alias"SetWindowPos" _
    (ByVal hwnd As Integer, _
    ByVal hWndInsertAfter As Integer, ByVal x As Integer, _
    ByVal y AsInteger, _
    ByVal cx As Integer, ByVal cy As Integer, _
    ByVal wFlags As Integer) As Integer
    
    '--This function destroys the specified window--
    Declare Function DestroyWindow Lib"user32" _
    (ByVal hndw As Integer) As Boolean
    
    '---used to identify the video source---
    Dim CamSource As Integer
    
    '---used as a window handle---
    Dim hWnd As Integer
    
    Private Sub cameraSource()
    Dim DriverName As String = Space(80)
    Dim DriverVersion As String = Space(80)
    For i As Integer = 0 To 9
    If capGetDriverDescriptionA(i, DriverName, 80, _
    DriverVersion, 80) Then
    ListBox1.Items.Add(DriverName.Trim)
    End If
    Next
    End Sub
    
    Private Sub previewCamera(ByVal pbCtrl As PictureBox)
    hWnd = capCreateCaptureWindowA(CamSource, _
    WS_VISIBLE Or WS_CHILD, 0, 0, 0, _
    0, pbCtrl.Handle.ToInt32, 0)
    If SendMessage( _
    hWnd, WM_CAP_DRIVER_CONNECT, _
    CamSource, 0) Then
    '---set the preview scale---
    SendMessage(hWnd, WM_CAP_SET_SCALE, True, 0)
    '---set the preview rate (ms)---
    SendMessage(hWnd, WM_CAP_SET_PREVIEWRATE, 30, 0)
    '---start previewing the image---
    SendMessage(hWnd, WM_CAP_SET_PREVIEW, True, 0)
    '---resize window to fit in PictureBox control---
    SetWindowPos(hWnd, HWND_BOTTOM, 0, 0, _
    pbCtrl.Width, pbCtrl.Height, _
    SWP_NOMOVE Or SWP_NOZORDER)
    Else
    '--error connecting to video source---
    DestroyWindow(hWnd)
    End If
    End Sub
    
    Private Sub stopPreviewCamera()
    SendMessage(hWnd, WM_CAP_DRIVER_DISCONNECT, CamSource, 0)
    DestroyWindow(hWnd)
    End Sub
    
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    cameraSource()
    Button4.Enabled = False
    Button1.Enabled = False
    Button2.Enabled = False
    Button3.Enabled = False
    End Sub
    
    Private Sub ListBox1_DoubleClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.DoubleClick
    Label1.Visible = False
    previewCamera(PictureBox1)
    Button1.Enabled = True
    Button4.Enabled = False
    Button2.Enabled = True
    End Sub
    
    Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
    CamSource = ListBox1.SelectedIndex
    '---preview the selected video source
    End Sub
    
    'stop preview
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    stopPreviewCamera()
    Button4.Enabled = True
    Button1.Enabled = False
    End Sub
    
    ' recording
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    Button3.Enabled = True
    Button2.Enabled = False
    SendMessage(hWnd, WM_CAP_SEQUENCE, 0, 0)
    End Sub
    
    ' stop recording and ask to save video
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
    Dim save As Integer
    save = MsgBox("Do you want to save your recording video", MsgBoxStyle.YesNo + MsgBoxStyle******rmation, "Recording Video")
    If (save = MsgBoxResult.Yes) Then
    Dim saveName As New SaveFileDialog
    saveName.Filter = "Avi file(*.avi)|*.avi"
    If saveName.ShowDialog = Windows.Forms.DialogResult.OK Then
    ' SendMessage(hWnd, WM_CAP_FILE_SAVEAS, 0, "C:\RecordedVideo.avi")
    SendMessage(hWnd, WM_CAP_FILE_SAVEAS, 0, saveName.FileName)
    End If
    End If
    Me.Cursor = System.Windows.Forms.Cursors.Default
    Button2.Enabled = True
    Button3.Enabled = False
    End Sub
    
    ' preview
    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
    CamSource = ListBox1.SelectedIndex
    previewCamera(PictureBox1)
    Button4.Enabled = False
    Button1.Enabled = True
    End Sub
    
    End Class
    Done, you can now use a webcam in your VB.net programs
    This Tutorial was leeched form CodenStuff. I am deeply sorry that i screwed that up. My friend said that he wrote the Tutorial himself I hope you guys can forgive me.
    Last edited by Bombsaway707; 02-23-2010 at 09:17 PM.

  2. The Following 4 Users Say Thank You to Bombsaway707 For This Useful Post:

    Blubb1337 (02-23-2010),FallenDark (10-30-2010),Steve323 (05-26-2010),[GER]Black_Ops (01-03-2016)

  3. #2
    Blubb1337's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Germany
    Posts
    5,915
    Reputation
    161
    Thanks
    3,109
    selfwritten o.O?

    gj tho.



  4. #3
    NextGen1's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Not sure really.
    Posts
    6,312
    Reputation
    382
    Thanks
    3,019
    My Mood
    Amazed
    Keep the coming guys , More tuts the better.

    Looks Good Bombs

    .................................................. .............


     


     


     



    The Most complete application MPGH will ever offer - 68%




  5. #4
    Zoom's Avatar
    Join Date
    May 2009
    Gender
    male
    Location
    Your going on my 24/7 DDoS hit list.
    Posts
    8,552
    Reputation
    127
    Thanks
    5,971
    My Mood
    Happy
    Since I don't have a webcam i can't test it!

    But it looks really good
    -Rest in peace leechers-

    Your PM box is 100% full.

  6. #5
    XGelite's Avatar
    Join Date
    Mar 2009
    Gender
    male
    Location
    Enter text here
    Posts
    1,344
    Reputation
    12
    Thanks
    276
    Quote Originally Posted by hejsan1 View Post
    Since I don't have a webcam i can't test it!

    But it looks really good
    same here. Cant test it, but looks good.

  7. #6
    NextGen1's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Not sure really.
    Posts
    6,312
    Reputation
    382
    Thanks
    3,019
    My Mood
    Amazed
    I don't remember the name off the top of my head, but there is a .net framework extension that uses a algorithm for motion tracking, (not motion detection, that's easy , motion tracking allows you to track multiple objects while they are in view of the camera) may be a good addition to this tut bombs.


     


     


     



    The Most complete application MPGH will ever offer - 68%




  8. #7
    Bombsaway707's Avatar
    Join Date
    Jun 2009
    Gender
    male
    Location
    Gym
    Posts
    8,799
    Reputation
    791
    Thanks
    4,004
    My Mood
    Amused
    Quote Originally Posted by NextGen1 View Post
    I don't remember the name off the top of my head, but there is a .net framework extension that uses a algorithm for motion tracking, (not motion detection, that's easy , motion tracking allows you to track multiple objects while they are in view of the camera) may be a good addition to this tut bombs.
    Hmm maybe lol i just figured out how to use the webcams though so idk if i can get that advanced xD

  9. #8
    axel fox's Avatar
    Join Date
    Aug 2009
    Gender
    male
    Posts
    60
    Reputation
    10
    Thanks
    1
    My Mood
    Amused
    i rly like this rly good job wondered when i was gona have a reason to try to sue web cams now i do ty

  10. #9
    Pixipixel_'s Avatar
    Join Date
    Oct 2009
    Gender
    male
    Location
    VCExpress.exe || France :D
    Posts
    2,087
    Reputation
    27
    Thanks
    742
    My Mood
    Cool
    Quote Originally Posted by hejsan1 View Post
    Since I don't have a webcam i can't test it!

    But it looks really good
    Same here xD

    But good job, looks really good.

  11. #10
    Bombsaway707's Avatar
    Join Date
    Jun 2009
    Gender
    male
    Location
    Gym
    Posts
    8,799
    Reputation
    791
    Thanks
    4,004
    My Mood
    Amused
    Quote Originally Posted by Pixipixel_ View Post


    Same here xD

    But good job, looks really good.
    Thanks bro

  12. #11
    ViittO's Avatar
    Join Date
    Feb 2010
    Gender
    male
    Posts
    168
    Reputation
    10
    Thanks
    25
    My Mood
    Psychedelic
    WOWW i can see you are good at C&P!!!!!
    exact copy from another website... even the screen shot! lmao
    webcam - iMBETA Instant Messenger

  13. The Following User Says Thank You to ViittO For This Useful Post:

    mnpeepno2 (02-23-2010)

  14. #12
    mnpeepno2's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    In a barren wasteland
    Posts
    905
    Reputation
    10
    Thanks
    81
    this is leeched give proper credits, or ill tell which site it came from to nextgen1, and you dont want that.
    EDIT: lol its already been revealed
    Last edited by mnpeepno2; 02-23-2010 at 07:19 PM.


    -----------------------------------------------

    My site: here
    My Blog: here
    My member's area: here
    Minecraft Sever Forum: here


    Minecraft Servers:

    Public:



    Private:



  15. #13
    ViittO's Avatar
    Join Date
    Feb 2010
    Gender
    male
    Posts
    168
    Reputation
    10
    Thanks
    25
    My Mood
    Psychedelic
    loll ye you could at least give credits if your gonna copy word for word

  16. #14
    mnpeepno2's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    In a barren wasteland
    Posts
    905
    Reputation
    10
    Thanks
    81
    also, this dosent work if you C&P word for word XD
    what a fail...


    -----------------------------------------------

    My site: here
    My Blog: here
    My member's area: here
    Minecraft Sever Forum: here


    Minecraft Servers:

    Public:



    Private:



  17. #15
    CoderNever's Avatar
    Join Date
    Feb 2009
    Gender
    female
    Location
    https://mpgh.net MPGHCash: $700,458,011
    Posts
    1,198
    Reputation
    131
    Thanks
    2,236
    My Mood
    Buzzed
    credits? I saw this exact tut awhile ago, down to the exact same picture even on the same link..

Page 1 of 2 12 LastLast

Similar Threads

  1. [Tutorial] Using HttpWebRequests to browse forums.
    By Jason in forum Visual Basic Programming
    Replies: 11
    Last Post: 03-31-2011, 06:19 AM
  2. [TUTORIAL] Using reCAPTCHA in PHP
    By AceKill3r in forum PHP Programming
    Replies: 0
    Last Post: 03-23-2011, 01:50 AM
  3. [TUTORIAL] Using FindPattern() To Get Addresses
    By J in forum Combat Arms Hack Coding / Programming / Source Code
    Replies: 5
    Last Post: 09-06-2010, 03:48 AM
  4. Thinking about leeching tutorials
    By why06 in forum C++/C Programming
    Replies: 6
    Last Post: 01-23-2010, 07:41 PM
  5. [Tutorial]Using Hotkeys VB 08
    By Pixie in forum Visual Basic Programming
    Replies: 2
    Last Post: 10-25-2009, 01:04 PM