Windows Form + Camara Web + Flash
-
miércoles, 27 de mayo de 2009 18:00
Hola que tal a todos:
Necesito desarrollar una aplicacion que elabore crendenciales. Para esto la aplicacion debera comunicarse con una webcam u otro tipo de camara y capturar la imagen obtenida de la camara, debera leer la firma de un capturador de firmas.
Tambien estaba pensando en agregarle algo de flash.
Es mi segunda aplicacion en Windows form. Y me gusto trabajar con Visual Studio. Alguien que pueda asesorarme y/o decirme donde encontrar la informacion necesaria para hacer la aplicacion??
Agradeceria mucho coolaboracion por minima que sea, y espero comentarios de esta pregunta.
SALUDOS a todos.
Todas las respuestas
-
miércoles, 27 de mayo de 2009 18:13
hola
mira lo unico que necesitas es utilizar crystal reports, se supone que tendras una webcam, un lector de firmas, y una impresora de credenciales de pvc, en cuanto al reporte, con que instales la impresora en la computadora en que vas a hacer el desarrollo y selecciones esa impresora en crystal, tendras una hoja del tamaño de la credencial, y por lo tanto estaras sacando reportes en pantalla al tamaño de la credencial.
en cuanto al lector de firmas y la webcam, estos normalmente traen archivos dll, que permiten comunicarse con ella, y lo unico que tendrias que hacer es agregar un control de la camara (pdria ser un ocx) a tu formulario y con eso estaras capturando las fotografias desde tu aplicación, se guardara en un archivo jpg, y luego cuando muestres el reporte este ira a leer ela rchivo que esta el disco duro y que es la fotografia, igualmente con el lector de firmas, pero ten cuidado en la marca y modelo de la camara web, y del lector de firmas.
en cuanto a flash no se para que lo usarias, a como entiendo tu aplicación, no seria necesario.
Saludos
Edgar López R.
si la respuesta te fue de utilidad, no olvides marcarla como correcta o útil.- Marcado como respuesta Juan Carlos Ruiz [BogotaDotNet.org]Moderator lunes, 01 de junio de 2009 13:52
-
miércoles, 27 de mayo de 2009 18:21Oye muchas gracias, que rapido recibi respuesta. La respuesta que me das es muy concreta me gusta. Voy a empezar a programarlo en 15 dias. Y ya estare informando mis dudas mas de programacion, mas que nada para tal vez en la utilizacion de las dll agregar controlos ocx (que si ya hay documentacion me gustaria empezarla a leer)y despues desarrollada la aplicacion.
Si se puede aportar al foro con el codigo para quienes a futuro esten bajo la misma polemica en la que me encuentro, por mi exelente seria una manera muy buena de agradecerle a los participantes de MSDN en general que en mi proyecto anterior tambien me apoyaron.
MIL GRACIAS -
miércoles, 27 de mayo de 2009 18:26que bueno que te sirvio, cualquier duda que tengas durante el desarrollo si podemos aqui te estaremos ayudando.
Saludos
Edgar López R.
si la respuesta te fue de utilidad, no olvides marcarla como correcta o útil. -
domingo, 31 de mayo de 2009 16:14
Ya me puse a buscarle por la red y encontre este util codigo, solo que esta en VB6 y yo estoy desarrollando con VB9 de Visual Studio 2008. El problema es que ya hize algunas equivalencia a VB9 pero no puedo con una: Picture1.hwnd. Este ejemplo incluye:
Dejo el codigo para el formulario de VB6 y despues incluyo las modificaciones que he hecho para VB9, espero puedan apoyarme:
DE ANTE MANO MIL GRACIAS
Option Explicit
Dim temp As Long' botón que inicia la captura
'''''''''''''''''''''''''''''''''''''''
Private Sub Command1_Click()
Dim temp As Longhwdc = capCreateCaptureWindow("CapWindow", ws_child Or ws_visible, _
0, 0, 320, 240, Picture1.hwnd, 0)
If (hwdc <> 0) Then
temp = SendMessage(hwdc, wm_cap_driver_connect, 0, 0)
temp = SendMessage(hwdc, wm_cap_set_preview, 1, 0)
temp = SendMessage(hwdc, WM_CAP_SET_PREVIEWRATE, 30, 0)
temp = SendMessage(hwdc, WM_CAP_SET_SCALE, True, 0)
'esto hace que la imagen recibida por el dispositivo se ajuste
'al tamaño de la ventana de captura (justo lo que yo buscaba)
DoEvents
startcap = True
Else
MsgBox "No hay Camara Web", 48, "Error"
End IfEnd Sub
' botón para detener la captura
'''''''''''''''''''''''''''''''''''''''
Private Sub Command2_Click()
temp = DestroyWindow(hwdc)
If startcap = True Then
temp = SendMessage(hwdc, WM_CAP_DRIVER_DISCONNECT, 0&, 0&)
DoEvents
startcap = False
End IfEnd Sub
' Botón que abre el dialogo de formato
''''''''''''''''''''''''''''''''''''''''''''
Private Sub Command3_Click()
If startcap = True Then
temp = SendMessage(hwdc, WM_CAP_DLG_VIDEOFORMAT, 0&, 0&)
DoEvents
End If
End Sub
' Mostrar dialogo de Configuracion de la WebCam
''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Sub Command4_Click()
Dim temp As Long
If startcap = True Then
temp = SendMessage(hwdc, WM_CAP_DLG_VIDEOCONFIG, 0&, 0&)
DoEvents
End If
End SubPrivate Sub Form_Load()
Command1.Caption = "Iniciar"
Command2.Caption = "Detener"
Command3.Caption = "Formato"
Command4.Caption = "Configurar"
Me.Caption = "Capturador de Web Cam"
End SubPrivate Sub Form_Resize()
On Error Resume Next
Move (Screen.Width - Width) \ 29, (Screen.Height - Height) \ 29
End SubPrivate Sub Form_Unload(Cancel As Integer)
temp = DestroyWindow(hwdc)
If startcap = True Then
temp = SendMessage(hwdc, WM_CAP_DRIVER_DISCONNECT, 0&, 0&)
DoEvents
startcap = False
End If
End Sub
================================================================
Option Explicit
PublicOption
Class Form1
Dim temp As Long
' bot¢n que inicia la captura
'''''''''''''''''''''''''''''''''''''''
Private Sub Command1_Click()
Dim temp As Long
hwdc = capCreateCaptureWindow("CapWindow", ws_child Or ws_visible, 0, 0, 320, 240, PictureBox1.hwnd, 0)
If (hwdc <> 0) Then
temp = SendMessage(hwdc, wm_cap_driver_connect, 0, 0)
temp = SendMessage(hwdc, wm_cap_set_preview, 1, 0)
temp = SendMessage(hwdc, WM_CAP_SET_PREVIEWRATE, 30, 0)
'temp = SendMessage(hwdc, WM_CAP_SET_SCALE, True, 0)
'esto hace que la imagen recibida por el dispositivo se ajuste
'al tama¤o de la ventana de captura (justo lo que yo buscaba)
Application.DoEvents()
startcap = True
Else
MsgBox("No hay Camara Web", 48, "Error")
End If
End Sub
' bot¢n para detener la captura
'''''''''''''''''''''''''''''''''''''''
Private Sub Command2_Click()
temp = DestroyWindow(hwdc)
If startcap = True Then
temp = SendMessage(hwdc, WM_CAP_DRIVER_DISCONNECT, 0&, 0&)
Application.DoEvents()
startcap = False
End If
End Sub
' Bot¢n que abre el dialogo de formato
''''''''''''''''''''''''''''''''''''''''''''
Private Sub Command3_Click()
If startcap = True Then
temp = SendMessage(hwdc, WM_CAP_DLG_VIDEOFORMAT, 0&, 0&)
Application.DoEvents()
End If
End Sub
' Mostrar dialogo de Configuracion de la WebCam
''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Sub Command4_Click()
Dim temp As Long
If startcap = True Then
temp = SendMessage(hwdc, WM_CAP_DLG_VIDEOCONFIG, 0&, 0&)
Application.DoEvents()
End If
End SubPrivate Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Button1.Text = "Iniciar"
Button2.Text = "Iniciar"
Button3.Text = "Iniciar"
Button4.Text = "Iniciar"
End SubPrivate Sub Form1_Resize(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Resize
Dim myControl As Control
myControl = sender
' Ensure the Form remains square (Height = Width).
If myControl.Size.Height <> myControl.Size.Width Then
myControl.Size = New Size(myControl.Size.Width, myControl.Size.Width)
End If
End SubPrivate Sub Form_Unload(ByVal Cancel As Integer)
temp = DestroyWindow(hwdc)
If startcap = True Then
temp = SendMessage(hwdc, WM_CAP_DRIVER_DISCONNECT, 0&, 0&)
Application.DoEvents()
startcap = False
End If
End Sub
End Class+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Codigo del modulo en VB6 y enseguida mis modificaciones para VB9:
Option Explicit
' declaraciones Api, constantes, variables
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public Const ws_child = &H40000000
Public Const ws_visible = &H10000000
Public Const WM_USER = 1024
Public Const wm_cap_driver_connect = WM_USER + 10
Public Const wm_cap_set_preview = WM_USER + 50
Public Const WM_CAP_SET_PREVIEWRATE = WM_USER + 52
Public Const WM_CAP_DRIVER_DISCONNECT = WM_USER + 11
Public Const WM_CAP_DLG_VIDEOFORMAT = WM_USER + 41
Public Const WM_CAP_DLG_VIDEOCONFIG = WM_USER + 42
Public Const WM_CAP_SET_SCALE = WM_USER + 53'Api para crear la ventana de captura
Public Declare Function capCreateCaptureWindow Lib "avicap32.dll" _
Alias "capCreateCaptureWindowA" ( _
ByVal lpszWindowName As String, _
ByVal dwStyle As Long, _
ByVal x As Long, _
ByVal y As Long, _
ByVal nWidth As Long, _
ByVal nHeight As Long, _
ByVal hwndParent As Long, _
ByVal nID As Long) As LongPublic Declare Function SendMessage Lib "user32" Alias "SendMessageA" ( _
ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) As LongPublic Declare Function DestroyWindow Lib "user32" (ByVal hndw As Long) As Boolean
'Solo 16 Bits (vb2, vb3 y vb4 de 16)
'Declare Function SendMessage Lib "User" ( _
ByVal hWnd As Integer, _
ByVal wMsg As Integer, _
ByVal wParam As Integer, _
lParam As Any) As Long
'Api para crear la ventana de captura
'Declare Function capCreateCaptureWindow Lib "avicap.dll" ( _
ByVal lpszWindowName As String, _
ByVal dwStyle As Long, _
ByVal x As Integer, _
ByVal y As Integer, _
ByVal nWidth As Integer, _
ByVal nHeight As Integer, _
ByVal hwndParent As Integer, _
ByVal nID As Integer) As Long
'Declare Function DestroyWindow Lib "User" (ByVal hndw As Integer) As Integer
Public hwdc As Long
Public startcap As Integer
============================================================Explicit On
Module bas' declaraciones Api, constantes, variables
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''Public Const ws_child = &H40000000
Public Const ws_visible = &H10000000
Public Const WM_USER = 1024
Public Const wm_cap_driver_connect = WM_USER + 10
Public Const wm_cap_set_preview = WM_USER + 50
Public Const WM_CAP_SET_PREVIEWRATE = WM_USER + 52
Public Const WM_CAP_DRIVER_DISCONNECT = WM_USER + 11
Public Const WM_CAP_DLG_VIDEOFORMAT = WM_USER + 41
Public Const WM_CAP_DLG_VIDEOCONFIG = WM_USER + 42
Public Const WM_CAP_SET_SCALE = WM_USER + 53'Api para crear la ventana de captura
<System.Runtime.InteropServices.DllImport(
"avicap32.dll")> _
Public Function capCreateCaptureWindow( _
ByVal lpszWindowName As String, _
ByVal dwStyle As Long, _
ByVal x As Long, _
ByVal y As Long, _
ByVal nWidth As Long, _
ByVal nHeight As Long, _
ByVal hwndParent As Long, _
ByVal nID As Long) As Long
End Function<System.Runtime.InteropServices.DllImport(
"user32.dll")> _
Public Function SendMessage( _
ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
<Runtime.InteropServices.MarshalAs(Runtime.InteropServices.UnmanagedType.AsAny)> ByVal lParam As Object) As Long
End Function'lParam As Any
'<MarshalAsAttribute(UnmanagedType.AsAny)> ByVal o As ObjectPublic Declare Function DestroyWindow Lib "user32" (ByVal hndw As Long) As Boolean
'Solo 16 Bits (vb2, vb3 y vb4 de 16)
Declare Function SendMessage Lib "User" ( _
ByVal hWnd As Integer, _
ByVal wMsg As Integer, _
ByVal wParam As Integer, _
<Runtime.InteropServices.MarshalAs(Runtime.InteropServices.UnmanagedType.AsAny)> ByVal lParam As Object) As Long'Api para crear la ventana de captura
Declare Function capCreateCaptureWindow Lib "avicap.dll" ( _
ByVal lpszWindowName As String, _
ByVal dwStyle As Long, _
ByVal x As Integer, _
ByVal y As Integer, _
ByVal nWidth As Integer, _
ByVal nHeight As Integer, _
ByVal hwndParent As Integer, _
ByVal nID As Integer) As Long
Declare Function DestroyWindow Lib "User" (ByVal hndw As Integer) As Integer
Public hwdc As Long
Public startcap As Integer
End Module- Un control PictureBox
- Cuatro Commandbutton
- Un módulo bas

