Dutch,
Here you have a dialog based version:
//-------------- --------------------------------------------------------------//
#include "Fivewin.ch"
#include "WebCam.ch"
static nTime, oWebCam
//----------------------------------------------------------------------------//
Function Main ()
Local oDlg, oMenu, oFont
local hBmp
MENU oMenu 2007
MENUITEM "&Opções"
MENU
MENUITEM "Ligar" ACTION ( oWebCam:Initialize(), MsgInfo( oWebCam:hWebCam ) );
WHEN !oWebCam:isConnected
MENUITEM "Desligar" ACTION oWebCam:Finalize();
WHEN oWebCam:isConnected
SEPARATOR
MENUITEM "Salvar Imagem" ACTION oWebCam:SaveFile();
WHEN oWebCam:isConnected
SEPARATOR
MENUITEM "Controle de Video" ACTION oWebCam:VideoControl();
WHEN oWebCam:isConnected
MENUITEM "Formatação de Video" ACTION oWebCam:VideoFormat();
WHEN oWebCam:isConnected
MENUITEM "Get Status" ACTION xbrowse( oWebCam:pStatus );
WHEN oWebCam:isConnected
SEPARATOR
MENUITEM "Sair" ACTION oDlg:End()
ENDMENU
MENUITEM "&Option"
MENU
MENUITEM "Start" ACTION oWebCam:Initialize();
WHEN !oWebCam:isConnected
MENUITEM "Stop" ACTION oWebCam:Finalize();
WHEN oWebCam:isConnected
SEPARATOR
MENUITEM "Save Picture" ACTION oWebCam:SaveFile();
WHEN oWebCam:isConnected
SEPARATOR
MENUITEM "Video Control" ACTION oWebCam:VideoControl();
WHEN oWebCam:isConnected
MENUITEM "Video Format" ACTION oWebCam:VideoFormat();
WHEN oWebCam:isConnected
MENUITEM "Start Capture" ACTION ( oWebCam:SetFile( "VideoCam.mpeg" ) ,;
oWebCam:StartCapture() )
MENUITEM "Stop Capture" ACTION ( oWebCam:StopCapture() )
SEPARATOR
MENUITEM "Exit" ACTION oDlg:End()
ENDMENU
ENDMENU
nTime = GetTickCount()
hBmp = ReadBitmap( 0, "..\bitmaps\AlphaBmp\iMac.bmp")
DEFINE DIALOG oDlg TITLE "Sample Class TWebCam" SIZE 700, 550 // MENU oMenu
DEFINE FONT oFont NAME "Arial Black" SIZE 30, 30
// SET MESSAGE OF oDlg TO oWebCam:cName+Space(6)+oWebCam:cVersion 2007
ACTIVATE DIALOG oDlg CENTERED ;
ON INIT BuildWebCam( oDlg, oFont, hBmp, oMenu )
oFont:End()
Return Nil
//----------------------------------------------------------------------------//
function BuildWebCam( oDlg, oFont, hBmp, oMenu )
@ 0, 0 WEBCAM oWebCam SIZE 640, 480 OF oDlg START ADJUST RATE 66
oWebCam:bLClicked = {|| MsgInfo( "ok") }
oWebCam:bPainted = {| hDC | WebPainted( oWebCam, hDC, oFont, hBmp ) }
oDlg:SetMenu( oMenu )
return Nil
#define DT_CENTER 0x01
FUNCTION WebPainted( oWebCam, hDC, oFont, hBmp )
local nFPS
local hOld
nFPS = Int( 1000 / ( GetTickCount() - nTime ) )
nTime = GetTickCount()
SetTextColor( hDC, CLR_WHITE )
hOld = SelectObject( hDC, oFont:hFont )
DrawTextTransparent( hDC, "FPS: " + cValToChar( nFPS ), GetClientRect( oWebCam:hWnd ), DT_CENTER )
ABPaint( hDC, 500, 10, hBmp, 150 )
SelectObject( hDC, hOld )
return nil