|
Postada em 10/02/2007 11:30 hs
Caros, estou precisando urgentemente deste rotina, se alguém puder me enviar um exemplo. vi alguns posts aqui no fórum mais nenhum funcionou.
|
|
|
|
LCRamos
|
GOIANIA GO - BRASIL
|
|
ENUNCIADA !
|
|
|
Postada em 10/02/2007 15:44 hs
Huber, se voce copiar e colar certinho, certinho, garanto que funciona. Em um módulo: Private Declare Function GetWindowLong Lib "user32" Alias _ "GetWindowLongA" (ByVal Hwnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLong Lib "user32" Alias _ "SetWindowLongA" (ByVal Hwnd As Long, ByVal nIndex As Long, _ ByVal dwNewLong As Long) As Long Private Const GWL_EXSTYLE = (-20) Private Const WS_EX_CLIENTEDGE = &H200 Private Const WS_EX_STATICEDGE = &H20000 Private Const SWP_FRAMECHANGED = &H20 Private Const SWP_NOMOVE = &H2 Private Const SWP_NOOWNERZORDER = &H200 Private Const SWP_NOSIZE = &H1 Private Const SWP_NOZORDER = &H4
No formulário, coloque um controle Picture e um Timer, e seus devidos CommandButtons, conforme seu formulário 'Inicia a câmera SendMessage mCapHwnd, WM_CAP_DRIVER_DISCONNECT, 0, 0 mCapHwnd = capCreateCaptureWindow("My Own Capture Window", 0, 0, 0, 320, 240, Me.Hwnd, 0) 'mCapHwnd = capCreateCaptureWindow("My Own Capture Window", 0, 0, 0, 3, 4, Me.hwnd, 0) SendMessage mCapHwnd, WM_CAP_DRIVER_CONNECT, 0, 0 Private Sub Timer1_Timer() 'Captura a imagem atual (PODERIA SER COLCOADO NUM TIMER PARA IMAGEM CONTINUA) Clipboard.Clear SendMessage mCapHwnd, WM_CAP_GRAB_FRAME, 0, 0 SendMessage mCapHwnd, WM_CAP_EDIT_COPY, 0, 0 pctFOTO.Picture = Clipboard.GetData() End Sub Para ligar a cam Clipboard.Clear SendMessage mCapHwnd, WM_CAP_GRAB_FRAME, 0, 0 SendMessage mCapHwnd, WM_CAP_EDIT_COPY, 0, 0 pctFOTO.Picture = Clipboard.GetData()
|
|
|
LCRamos
|
GOIANIA GO - BRASIL
|
|
ENUNCIADA !
|
|
|
Postada em 10/02/2007 15:47 hs
Faltou: 'Desliga a câmera SendMessage mCapHwnd, WM_CAP_DRIVER_DISCONNECT, 0, 0 Gravar a imagem captdata: SavePicture pctFOTO.Picture, "DRIVEsPASTAomearquivo.BMP" vlu//
|
|
|
|
|
LCRamos
|
GOIANIA GO - BRASIL
|
|
ENUNCIADA !
|
|
|
Postada em 10/02/2007 20:45 hs
Olhe, me desculpe, mas as declarações da cam em um módulo, são estas: 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 Long Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal Hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long Public Declare Function ReleaseCapture Lib "user32" () As Long Public Const WM_CAP_DRIVER_CONNECT As Long = 1034 Public Const WM_CAP_DRIVER_DISCONNECT As Long = 1035 Public Const WM_CAP_GRAB_FRAME As Long = 1084 Public Const WM_CAP_EDIT_COPY As Long = 1054 Public Const WM_CAP_DLG_VIDEOFORMAT As Long = 1065 Public Const WM_CAP_DLG_VIDEOSOURCE As Long = 1066 Public Const WM_CLOSE = &H10 Public mCapHwnd As Long O restante está OK. Quanto a captura da imagem em continua, uso o interval 100. Quanto a salvar em uma pasta: SavePicture Picture1.Picture, "C:PASTANOMEDOARQUIVO.BMP" Pode ser também no JPG. vlu//
|
|
|
ph@byo
|
SÃO PAULO SP - BRASIL
|
|
ENUNCIADA !
|
|
|
Postada em 01/06/2007 00:49 hs
Valeu LCRamos, Funcionou tudo aqui, Direitinho. Quebrou uma arvore e não um galho, eh eh eh.
Ph@byo
|
|
|
|