Kirjautuminen

Haku

Tehtävät

Keskustelu: Ohjelmointikysymykset: VB.NET: vb.NET:screen recorder

Sivun loppuun

thekoodaaja [14.08.2005 15:17:18]

#

Onko mahdollista, etta tekisi sellaisen ohjelman vb.Net:illä, joka painaisi 30 kertaa sekunnissa prt sc nappulaa ja tallentaisi sen johonki *.avi taikka johonkin vastaavaan standardiin? Ja vielä piatisi saada sellainen ominaisuus, että voisi rajata sen tiettyyn alueeseen.

panttu [14.08.2005 15:52:34]

#

Eikai ihan noin hankalaa klikkailua tarvitse tehdä. Tutustu seuraavaan artikkeliin.
http://www.codeproject.com/vb/net/CaptureScreenAsVideo.asp

Puhveli [14.08.2005 16:21:43]

#

Ainakaan vb:n omalla SendKeys-funkkarilla ei voi virtuaalipainaa PrintScreeniä, mikä on estetty varmaan vakoiluohjelmien teon vaikeuttamiseksi, se sanotaan jo vb:n manuskassakin. (Yritin itse kerran tehdä sellaista koulun koneilla mutta ei onnistu). Lue tosiaan em. artikkeli.

thekoodaaja [14.08.2005 20:05:01]

#

Tuo toimii suhteellisen hyvin, mutta olisi viel pari kysymystä miten saisi tuon laadun paranemaan ja miten saisi tehtya sellainen boxi, joka nayttaisi sen kohdan siis mista se ottaa sen kuvan? Siis sellainen kuin joissain mspaintissa tai vastaavassa.

panttu [14.08.2005 21:20:40]

#

Alla olevasta luokasta löytyy kuvaus asetuksiin liittyvää.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmencode/htm/iwmencaudienceobjobject.asp

thekoodaaja [15.08.2005 07:33:40]

#

Oon tallanen nobo ja en muista kesän jälkeen mihin syntax tulee. :D

thekoodaaja [15.08.2005 21:28:30]

#

tai varmaan on jo olemassasellainen ilmaien ohjelma jossa pystyy rajaamaan kunvan tiettyyn alueeseen ja se tallentaa siita videota mutta kun en löydä sitä. :(

miiro [21.08.2005 12:55:32]

#

thekoodaaja kirjoitti:

tai varmaan on jo olemassasellainen ilmaien ohjelma jossa pystyy rajaamaan kunvan tiettyyn alueeseen

http://www.hyperionics.com/hc/downloads.asp
Tuolta saa HyperCamin vanhan version - ilmainen

Niko [22.08.2005 22:15:24]

#

Imports System
Imports System.Windows.Forms
Imports System.Drawing




Public Class Form1
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    Friend WithEvents kohde As System.Windows.Forms.SaveFileDialog
    Friend WithEvents LinkLabel1 As System.Windows.Forms.LinkLabel
    Friend WithEvents kohde_lbl As System.Windows.Forms.TextBox
    Friend WithEvents LinkLabel2 As System.Windows.Forms.LinkLabel
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents LinkLabel3 As System.Windows.Forms.LinkLabel
    Friend WithEvents CheckBox1 As System.Windows.Forms.CheckBox
    Friend WithEvents leveys As System.Windows.Forms.TextBox
    Friend WithEvents korkeus As System.Windows.Forms.TextBox
    Friend WithEvents LinkLabel4 As System.Windows.Forms.LinkLabel
    Friend WithEvents jou As System.Windows.Forms.ContextMenu
    Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem
    Friend WithEvents MenuItem2 As System.Windows.Forms.MenuItem
    Friend WithEvents MenuItem3 As System.Windows.Forms.MenuItem
    Friend WithEvents MenuItem4 As System.Windows.Forms.MenuItem
    Friend WithEvents fourcc As System.Windows.Forms.TextBox
    Friend WithEvents MenuItem5 As System.Windows.Forms.MenuItem
    Friend WithEvents MenuItem6 As System.Windows.Forms.MenuItem
    Friend WithEvents MenuItem7 As System.Windows.Forms.MenuItem
    Friend WithEvents MenuItem8 As System.Windows.Forms.MenuItem
    Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents Button2 As System.Windows.Forms.Button
    Friend WithEvents Button3 As System.Windows.Forms.Button
    Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox
    Friend WithEvents nappi_alku As System.Windows.Forms.Button
    Friend WithEvents nappi_loppu As System.Windows.Forms.Button
    Friend WithEvents Label5 As System.Windows.Forms.Label
    Friend WithEvents fps As System.Windows.Forms.TextBox
    Friend WithEvents LinkLabel5 As System.Windows.Forms.LinkLabel
    Friend WithEvents LinkLabel6 As System.Windows.Forms.LinkLabel
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents korkeus2 As System.Windows.Forms.TextBox
    Friend WithEvents leveys2 As System.Windows.Forms.TextBox
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents tila As System.Windows.Forms.StatusBar
    Friend WithEvents paivita As System.Windows.Forms.Timer
    Friend WithEvents nauh As System.Windows.Forms.StatusBarPanel
    Friend WithEvents tfps As System.Windows.Forms.StatusBarPanel
    Friend WithEvents aika As System.Windows.Forms.StatusBarPanel
    Friend WithEvents buffer As System.Windows.Forms.StatusBarPanel
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container
        Me.kohde = New System.Windows.Forms.SaveFileDialog
        Me.LinkLabel1 = New System.Windows.Forms.LinkLabel
        Me.kohde_lbl = New System.Windows.Forms.TextBox
        Me.LinkLabel2 = New System.Windows.Forms.LinkLabel
        Me.leveys = New System.Windows.Forms.TextBox
        Me.korkeus = New System.Windows.Forms.TextBox
        Me.Label1 = New System.Windows.Forms.Label
        Me.LinkLabel3 = New System.Windows.Forms.LinkLabel
        Me.CheckBox1 = New System.Windows.Forms.CheckBox
        Me.LinkLabel4 = New System.Windows.Forms.LinkLabel
        Me.fourcc = New System.Windows.Forms.TextBox
        Me.jou = New System.Windows.Forms.ContextMenu
        Me.MenuItem1 = New System.Windows.Forms.MenuItem
        Me.MenuItem2 = New System.Windows.Forms.MenuItem
        Me.MenuItem3 = New System.Windows.Forms.MenuItem
        Me.MenuItem4 = New System.Windows.Forms.MenuItem
        Me.MenuItem5 = New System.Windows.Forms.MenuItem
        Me.MenuItem6 = New System.Windows.Forms.MenuItem
        Me.MenuItem7 = New System.Windows.Forms.MenuItem
        Me.MenuItem8 = New System.Windows.Forms.MenuItem
        Me.GroupBox1 = New System.Windows.Forms.GroupBox
        Me.Button3 = New System.Windows.Forms.Button
        Me.Button2 = New System.Windows.Forms.Button
        Me.Button1 = New System.Windows.Forms.Button
        Me.GroupBox2 = New System.Windows.Forms.GroupBox
        Me.nappi_alku = New System.Windows.Forms.Button
        Me.nappi_loppu = New System.Windows.Forms.Button
        Me.Label5 = New System.Windows.Forms.Label
        Me.fps = New System.Windows.Forms.TextBox
        Me.LinkLabel5 = New System.Windows.Forms.LinkLabel
        Me.LinkLabel6 = New System.Windows.Forms.LinkLabel
        Me.Label2 = New System.Windows.Forms.Label
        Me.korkeus2 = New System.Windows.Forms.TextBox
        Me.leveys2 = New System.Windows.Forms.TextBox
        Me.Label3 = New System.Windows.Forms.Label
        Me.tila = New System.Windows.Forms.StatusBar
        Me.nauh = New System.Windows.Forms.StatusBarPanel
        Me.tfps = New System.Windows.Forms.StatusBarPanel
        Me.aika = New System.Windows.Forms.StatusBarPanel
        Me.buffer = New System.Windows.Forms.StatusBarPanel
        Me.paivita = New System.Windows.Forms.Timer(Me.components)
        Me.GroupBox1.SuspendLayout()
        Me.GroupBox2.SuspendLayout()
        CType(Me.nauh, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.tfps, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.aika, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.buffer, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'kohde
        '
        Me.kohde.Filter = "Video|*.avi"
        '
        'LinkLabel1
        '
        Me.LinkLabel1.Location = New System.Drawing.Point(8, 8)
        Me.LinkLabel1.Name = "LinkLabel1"
        Me.LinkLabel1.Size = New System.Drawing.Size(56, 16)
        Me.LinkLabel1.TabIndex = 0
        Me.LinkLabel1.TabStop = True
        Me.LinkLabel1.Text = "Kohde:"
        '
        'kohde_lbl
        '
        Me.kohde_lbl.BackColor = System.Drawing.Color.White
        Me.kohde_lbl.BorderStyle = System.Windows.Forms.BorderStyle.None
        Me.kohde_lbl.Location = New System.Drawing.Point(56, 8)
        Me.kohde_lbl.Name = "kohde_lbl"
        Me.kohde_lbl.Size = New System.Drawing.Size(160, 13)
        Me.kohde_lbl.TabIndex = 1
        Me.kohde_lbl.Text = ""
        '
        'LinkLabel2
        '
        Me.LinkLabel2.Location = New System.Drawing.Point(8, 32)
        Me.LinkLabel2.Name = "LinkLabel2"
        Me.LinkLabel2.Size = New System.Drawing.Size(72, 16)
        Me.LinkLabel2.TabIndex = 2
        Me.LinkLabel2.TabStop = True
        Me.LinkLabel2.Text = "Resoluutio"
        '
        'leveys
        '
        Me.leveys.BorderStyle = System.Windows.Forms.BorderStyle.None
        Me.leveys.Location = New System.Drawing.Point(80, 32)
        Me.leveys.Name = "leveys"
        Me.leveys.Size = New System.Drawing.Size(48, 13)
        Me.leveys.TabIndex = 3
        Me.leveys.Text = "1280"
        '
        'korkeus
        '
        Me.korkeus.BorderStyle = System.Windows.Forms.BorderStyle.None
        Me.korkeus.Location = New System.Drawing.Point(144, 32)
        Me.korkeus.Name = "korkeus"
        Me.korkeus.Size = New System.Drawing.Size(48, 13)
        Me.korkeus.TabIndex = 4
        Me.korkeus.Text = "1024"
        '
        'Label1
        '
        Me.Label1.Location = New System.Drawing.Point(128, 32)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(16, 16)
        Me.Label1.TabIndex = 5
        Me.Label1.Text = "x"
        '
        'LinkLabel3
        '
        Me.LinkLabel3.Location = New System.Drawing.Point(8, 72)
        Me.LinkLabel3.Name = "LinkLabel3"
        Me.LinkLabel3.Size = New System.Drawing.Size(56, 16)
        Me.LinkLabel3.TabIndex = 6
        Me.LinkLabel3.TabStop = True
        Me.LinkLabel3.Text = "FPS"
        '
        'CheckBox1
        '
        Me.CheckBox1.Appearance = System.Windows.Forms.Appearance.Button
        Me.CheckBox1.Enabled = False
        Me.CheckBox1.Location = New System.Drawing.Point(16, 128)
        Me.CheckBox1.Name = "CheckBox1"
        Me.CheckBox1.Size = New System.Drawing.Size(88, 24)
        Me.CheckBox1.TabIndex = 9
        Me.CheckBox1.Text = "Kaappaa ääni"
        '
        'LinkLabel4
        '
        Me.LinkLabel4.Location = New System.Drawing.Point(8, 96)
        Me.LinkLabel4.Name = "LinkLabel4"
        Me.LinkLabel4.Size = New System.Drawing.Size(48, 16)
        Me.LinkLabel4.TabIndex = 11
        Me.LinkLabel4.TabStop = True
        Me.LinkLabel4.Text = "FourCC"
        '
        'fourcc
        '
        Me.fourcc.ContextMenu = Me.jou
        Me.fourcc.Location = New System.Drawing.Point(80, 96)
        Me.fourcc.Name = "fourcc"
        Me.fourcc.Size = New System.Drawing.Size(72, 20)
        Me.fourcc.TabIndex = 12
        Me.fourcc.Text = ""
        '
        'jou
        '
        Me.jou.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem1, Me.MenuItem2, Me.MenuItem3, Me.MenuItem4, Me.MenuItem5, Me.MenuItem6, Me.MenuItem7, Me.MenuItem8})
        '
        'MenuItem1
        '
        Me.MenuItem1.Index = 0
        Me.MenuItem1.Text = "Ei pakkausta"
        '
        'MenuItem2
        '
        Me.MenuItem2.Index = 1
        Me.MenuItem2.Text = "-"
        '
        'MenuItem3
        '
        Me.MenuItem3.Index = 2
        Me.MenuItem3.Text = "XviD"
        '
        'MenuItem4
        '
        Me.MenuItem4.Index = 3
        Me.MenuItem4.Text = "DivX"
        '
        'MenuItem5
        '
        Me.MenuItem5.Index = 4
        Me.MenuItem5.Text = "Microsoft MPEG 4"
        '
        'MenuItem6
        '
        Me.MenuItem6.Index = 5
        Me.MenuItem6.Text = "Indeo 5 (Suositeltu)"
        '
        'MenuItem7
        '
        Me.MenuItem7.Index = 6
        Me.MenuItem7.Text = "-"
        '
        'MenuItem8
        '
        Me.MenuItem8.Index = 7
        Me.MenuItem8.Text = "Anna FourCC"
        '
        'GroupBox1
        '
        Me.GroupBox1.Controls.Add(Me.Button3)
        Me.GroupBox1.Controls.Add(Me.Button2)
        Me.GroupBox1.Controls.Add(Me.Button1)
        Me.GroupBox1.Location = New System.Drawing.Point(288, 144)
        Me.GroupBox1.Name = "GroupBox1"
        Me.GroupBox1.Size = New System.Drawing.Size(224, 112)
        Me.GroupBox1.TabIndex = 21
        Me.GroupBox1.TabStop = False
        Me.GroupBox1.Text = "Testaus"
        Me.GroupBox1.Visible = False
        '
        'Button3
        '
        Me.Button3.Location = New System.Drawing.Point(16, 80)
        Me.Button3.Name = "Button3"
        Me.Button3.Size = New System.Drawing.Size(200, 24)
        Me.Button3.TabIndex = 22
        Me.Button3.Text = "Sulje tiedosto"
        '
        'Button2
        '
        Me.Button2.Location = New System.Drawing.Point(16, 16)
        Me.Button2.Name = "Button2"
        Me.Button2.Size = New System.Drawing.Size(200, 24)
        Me.Button2.TabIndex = 21
        Me.Button2.Text = "Avaa tiedosto"
        '
        'Button1
        '
        Me.Button1.Location = New System.Drawing.Point(16, 48)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(200, 24)
        Me.Button1.TabIndex = 0
        Me.Button1.Text = "Kaappaa && Tallenna (1 ruutu)"
        '
        'GroupBox2
        '
        Me.GroupBox2.Controls.Add(Me.nappi_alku)
        Me.GroupBox2.Controls.Add(Me.nappi_loppu)
        Me.GroupBox2.Location = New System.Drawing.Point(16, 160)
        Me.GroupBox2.Name = "GroupBox2"
        Me.GroupBox2.Size = New System.Drawing.Size(88, 80)
        Me.GroupBox2.TabIndex = 24
        Me.GroupBox2.TabStop = False
        Me.GroupBox2.Text = "Nauhoitus"
        '
        'nappi_alku
        '
        Me.nappi_alku.Location = New System.Drawing.Point(8, 16)
        Me.nappi_alku.Name = "nappi_alku"
        Me.nappi_alku.Size = New System.Drawing.Size(72, 24)
        Me.nappi_alku.TabIndex = 25
        Me.nappi_alku.Text = "Aloita"
        '
        'nappi_loppu
        '
        Me.nappi_loppu.Enabled = False
        Me.nappi_loppu.Location = New System.Drawing.Point(8, 48)
        Me.nappi_loppu.Name = "nappi_loppu"
        Me.nappi_loppu.Size = New System.Drawing.Size(72, 24)
        Me.nappi_loppu.TabIndex = 24
        Me.nappi_loppu.Text = "Lopeta"
        '
        'Label5
        '
        Me.Label5.Location = New System.Drawing.Point(152, 72)
        Me.Label5.Name = "Label5"
        Me.Label5.Size = New System.Drawing.Size(256, 56)
        Me.Label5.TabIndex = 25
        Me.Label5.Text = "Fourccn pohjalta laskettu numero (0 = ei pakkausta). Varmista että valittu koodik" & _
        "ki on asennettuna!! Saat valikon yleisimmistä hiiren oikeasta napista"
        '
        'fps
        '
        Me.fps.Location = New System.Drawing.Point(80, 72)
        Me.fps.Name = "fps"
        Me.fps.Size = New System.Drawing.Size(72, 20)
        Me.fps.TabIndex = 26
        Me.fps.Text = "25"
        '
        'LinkLabel5
        '
        Me.LinkLabel5.Location = New System.Drawing.Point(200, 32)
        Me.LinkLabel5.Name = "LinkLabel5"
        Me.LinkLabel5.Size = New System.Drawing.Size(64, 16)
        Me.LinkLabel5.TabIndex = 27
        Me.LinkLabel5.TabStop = True
        Me.LinkLabel5.Text = "Hae"
        '
        'LinkLabel6
        '
        Me.LinkLabel6.Location = New System.Drawing.Point(8, 48)
        Me.LinkLabel6.Name = "LinkLabel6"
        Me.LinkLabel6.Size = New System.Drawing.Size(56, 16)
        Me.LinkLabel6.TabIndex = 28
        Me.LinkLabel6.TabStop = True
        Me.LinkLabel6.Text = "Tallenna"
        '
        'Label2
        '
        Me.Label2.Location = New System.Drawing.Point(128, 48)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(16, 16)
        Me.Label2.TabIndex = 31
        Me.Label2.Text = "x"
        '
        'korkeus2
        '
        Me.korkeus2.BorderStyle = System.Windows.Forms.BorderStyle.None
        Me.korkeus2.Enabled = False
        Me.korkeus2.Location = New System.Drawing.Point(144, 48)
        Me.korkeus2.Name = "korkeus2"
        Me.korkeus2.Size = New System.Drawing.Size(48, 13)
        Me.korkeus2.TabIndex = 30
        Me.korkeus2.Text = "0"
        '
        'leveys2
        '
        Me.leveys2.BorderStyle = System.Windows.Forms.BorderStyle.None
        Me.leveys2.Enabled = False
        Me.leveys2.Location = New System.Drawing.Point(80, 48)
        Me.leveys2.Name = "leveys2"
        Me.leveys2.Size = New System.Drawing.Size(48, 13)
        Me.leveys2.TabIndex = 29
        Me.leveys2.Text = "0"
        '
        'Label3
        '
        Me.Label3.Location = New System.Drawing.Point(232, 32)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(128, 16)
        Me.Label3.TabIndex = 33
        Me.Label3.Text = "PELISSÄ KÄYTETTÄVÄ"
        '
        'tila
        '
        Me.tila.Location = New System.Drawing.Point(0, 298)
        Me.tila.Name = "tila"
        Me.tila.Panels.AddRange(New System.Windows.Forms.StatusBarPanel() {Me.nauh, Me.tfps, Me.aika, Me.buffer})
        Me.tila.ShowPanels = True
        Me.tila.Size = New System.Drawing.Size(520, 22)
        Me.tila.TabIndex = 34
        '
        'nauh
        '
        Me.nauh.Text = "Nauhoitettu: 0 f"
        Me.nauh.Width = 150
        '
        'tfps
        '
        Me.tfps.Text = "FPS: 0"
        Me.tfps.Width = 125
        '
        'aika
        '
        Me.aika.Text = "Aika: 0 s"
        '
        'buffer
        '
        Me.buffer.Text = "Bufferi: 0 f"
        '
        'paivita
        '
        Me.paivita.Interval = 1000
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(520, 320)
        Me.ContextMenu = Me.jou
        Me.Controls.Add(Me.tila)
        Me.Controls.Add(Me.Label3)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.korkeus2)
        Me.Controls.Add(Me.leveys2)
        Me.Controls.Add(Me.LinkLabel6)
        Me.Controls.Add(Me.LinkLabel5)
        Me.Controls.Add(Me.fps)
        Me.Controls.Add(Me.Label5)
        Me.Controls.Add(Me.GroupBox2)
        Me.Controls.Add(Me.GroupBox1)
        Me.Controls.Add(Me.fourcc)
        Me.Controls.Add(Me.LinkLabel4)
        Me.Controls.Add(Me.CheckBox1)
        Me.Controls.Add(Me.LinkLabel3)
        Me.Controls.Add(Me.Label1)
        Me.Controls.Add(Me.korkeus)
        Me.Controls.Add(Me.leveys)
        Me.Controls.Add(Me.LinkLabel2)
        Me.Controls.Add(Me.kohde_lbl)
        Me.Controls.Add(Me.LinkLabel1)
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow
        Me.Name = "Form1"
        Me.Text = "VideoCAP"
        Me.GroupBox1.ResumeLayout(False)
        Me.GroupBox2.ResumeLayout(False)
        CType(Me.nauh, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.tfps, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.aika, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.buffer, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)

    End Sub

#End Region
    Private Declare Function CreateDC Lib "gdi32" Alias "CreateDCA" (ByVal lpDriverName As String, ByVal lpDeviceName As String, ByVal lpOutput As String, ByVal lpInitData As String) As Integer
    Private Declare Function CreateCompatibleDC Lib "GDI32" (ByVal hDC As Integer) As Integer
    Private Declare Function CreateCompatibleBitmap Lib "GDI32" (ByVal hDC As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer) As Integer
    Private Declare Function GetDeviceCaps Lib "gdi32" Alias "GetDeviceCaps" (ByVal hdc As Integer, ByVal nIndex As Integer) As Integer
    Private Declare Function SelectObject Lib "GDI32" (ByVal hDC As Integer, ByVal hObject As Integer) As Integer
    Private Declare Function BitBlt Lib "GDI32" (ByVal srchDC As Integer, ByVal srcX As Integer, ByVal srcY As Integer, ByVal srcW As Integer, ByVal srcH As Integer, ByVal desthDC As Integer, ByVal destX As Integer, ByVal destY As Integer, ByVal op As Integer) As Integer
    Private Declare Function DeleteDC Lib "GDI32" (ByVal hDC As Integer) As Integer
    Private Declare Function DeleteObject Lib "GDI32" (ByVal hObj As Integer) As Integer
    Const SRCCOPY As Integer = &HCC0020
    Private kuva As Bitmap
    Private FW, FH As Integer
    Dim testaa As Boolean
    Dim int2 As Integer
    Dim buff As Integer
    Dim kulunu As Long
    Dim avi As AviLib.AviWriter
    Dim sleep_time As Integer
    Dim kaappaus As New Threading.Thread(AddressOf WriteFrame)

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Protected Sub Capture_screen()
        Dim hSDC, hMDC As Integer
        Dim hBMP, hBMPOld As Integer
        Dim r As Integer
        hSDC = CreateDC("DISPLAY", "", "", "")
        hMDC = CreateCompatibleDC(hSDC)
        FW = GetDeviceCaps(hSDC, 8)
        FH = GetDeviceCaps(hSDC, 10)
        hBMP = CreateCompatibleBitmap(hSDC, FW, FH)
        hBMPOld = SelectObject(hMDC, hBMP)
        r = BitBlt(hMDC, 0, 0, FW, FH, hSDC, 0, 0, 13369376)
        hBMP = SelectObject(hMDC, hBMPOld)
        r = DeleteDC(hSDC)
        r = DeleteDC(hMDC)
        kuva = Image.FromHbitmap(New IntPtr(hBMP))
        DeleteObject(hBMP)
    End Sub


    Private Sub kohde_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles kohde.FileOk
        kohde_lbl.Text = kohde.FileName
    End Sub

    Private Sub kohde_lbl_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles kohde_lbl.Click
        kohde.ShowDialog()
    End Sub



    Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem1.Click
        fourcc.Text = System.Convert.ToInt32(AviLib.AviCompression.None)
    End Sub

    Private Sub MenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem3.Click
        fourcc.Text = System.Convert.ToInt32(AviLib.AviCompression.XviD)
    End Sub

    Private Sub MenuItem4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem4.Click
        fourcc.Text = System.Convert.ToInt32(AviLib.AviCompression.DivX)
    End Sub

    Private Sub MenuItem5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem5.Click
        fourcc.Text = System.Convert.ToInt32(AviLib.AviCompression.MicrosoftMPEG4)
    End Sub

    Private Sub MenuItem6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem6.Click
        fourcc.Text = System.Convert.ToInt32(AviLib.AviCompression.Indeo5)
    End Sub

    Private Sub MenuItem8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem8.Click
        Dim str As String = InputBox("Anna FourCC", , "xvid")
        fourcc.Text = System.Convert.ToInt32(AviLib.AviCompression.GetFourCC(str))
    End Sub

    Private Sub WriteFrame()
        Do
            Capture_screen()
            avi.WriteFrame(kuva)
            ' 28f/20s
            int2 = int2 + 1
            ' Application.DoEvents()
            ' kaappaus.Sleep(sleep_time)
        Loop
    End Sub

    Private Sub nappi_alku_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nappi_alku.Click
        If fourcc.Text <> "" And kohde_lbl.Text <> "" And leveys.Text <> "" And korkeus.Text <> "" Then
            testaa = True
            avi = New AviLib.AviWriter(kohde_lbl.Text, Convert.ToUInt32(fourcc.Text), System.Convert.ToUInt32(fps.Text), leveys.Text, korkeus.Text)
            sleep_time = Convert.ToInt32((1000 / (fps.Text))) - 1

            kaappaus.Start()
            paivita.Start()

        Else
            MsgBox("Anna kaikki tiedot")
        End If
        nappi_alku.Enabled = False
        nappi_loppu.Enabled = True
    End Sub

    Private Sub nappi_loppu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nappi_loppu.Click
        kaappaus.Abort()
        paivita.Stop()
        avi.Close()
        nappi_alku.Enabled = True
        nappi_loppu.Enabled = False
    End Sub

    Private Sub LinkLabel5_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel5.LinkClicked
        Capture_screen()
        korkeus.Text = kuva.Height
        leveys.Text = kuva.Width
    End Sub

    Private Sub paivita_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles paivita.Tick
        kulunu = kulunu + 1
        aika.Text = "Aika: " & Int(kulunu) & " s"
        nauh.Text = "Nauhoitettu: " & Int(int2) & " f (d: " & ((Int(fps.Text) * kulunu) - int2) & ")"
        tfps.Text = "FPS: " & int2 / kulunu
        buffer.Text = "Bufferi: ei käytössä"
    End Sub
End Class

Googleta avilib niin saat tarvittavan kirjaston.

Sitten voit rajata tiettyyn alueseen
ja merkkauksen voit tehdä läpinäkyvällä lomakkeella jossa punaset reunat esimerkiksi

thekoodaaja [23.08.2005 17:31:21]

#

En löydä tuohon koodiin sita kirjastoa löydän siis kyllä sen eri kielille mutta en VB.NRT:Ille.

panttu [23.08.2005 18:05:56]

#

Löysin tuollaisen paketin: http://midget3d.com/gabe/AviLib.zip
, mutta eipä tuota ole helpposaada toimimaan, kun vb.net ohjelmat ainakin Visual Studio 2005 betassa muodostuu kiljoonasta tiedostosta ja tuossa esimerkissä on vain yksi. Eli joutunee opettelee tuon esimerkin ja kirjoittamaan oman ohjelman, jollei Nikolla ole netissä jaossa tai muuten tietoa enemmän.

Niko [23.08.2005 19:12:41]

#

Ei välttämättä. Kopioit vain Form1.vbhen toun...

www.pahajoki.info/WindowsApplication1.rar

panttu [24.08.2005 18:12:42]

#

DirectXkin näköjään osaa tuon http://www.codeproject.com/cs/media/directxcapture.asp


Sivun alkuun

Vastaus

Aihe on jo aika vanha, joten et voi enää vastata siihen.

Tietoa sivustosta