Despues tengo un contador, que es el q simula el reloj descendiente y despues esta el metodo para finalizar la grabacion. si uds copian esto en un form va a andar creo que perfectamente..El tema es que la unica forma de hacer parar la grabacion es presionando el boton.. No logro que me entre de alguna forma al procedimiento timer1_tick..
Es como si se colgara. Es mas, cuando el formulario esta grabando, se pone el icono del mouse con el relojito de arena..No se como hacer para que despues de 30 segundos lo guarde.
Bueno, espero su ayuda, comentarios.. cualquier otra ayuda vendria barbaro igualmente, mas alla que no sea utilizando el codigo de abajo..Nose.. estoy trabado..je..
Mil gracias.. y saludos a todos Martin
Código:
Imports System Imports System.Runtime.InteropServices Public Class Presentacion 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 As Integer, _ ByVal lpszVer As String, _ ByVal cbVer As Integer) As Boolean '--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 As Integer, _ 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 VideoSource As Integer '---used as a window handle--- Dim hWnd As Integer Dim i As Integer = 30 Private Sub btnInicio_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btninicio.Click Timer1.Enabled = True 'btnStartRecording.Enabled = False 'btnStopRecording.Enabled = True '---start recording--- SendMessage(hWnd, WM_CAP_SEQUENCE, 0, 0) End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick If i >= 0 Then lbltic.Text = CStr(i) + ":00" i -= 1 If i = -1 Then Me.Label1.Visible = True Me.btnFin_Click(sender, e) End If End If End Sub Private Sub btnFin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnfin.Click Timer1.Stop() SendMessage(hWnd, WM_CAP_FILE_SAVEAS, 0, "C:\recordedvideo.avi") End Sub End Class