FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour TWebCam doesn't load driver when use with DIALOG
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
TWebCam doesn't load driver when use with DIALOG
Posted: Mon Sep 01, 2014 05:40 AM

TWebCam : WebCam.PRG is working well with WINDOW but it has shown as below when use with DIALOG.
MsgAlert("Load Driver Error"+CRLF+"Check WebCam connection.")
Is it compatible with DIALOG? If not, How to setup WINDOW as MODAL (Lock the previous screen until release current WINDOW)?

Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: TWebCam doesn't load driver when use with DIALOG
Posted: Mon Sep 01, 2014 07:17 AM
Dutch,

Here you have a dialog based version:

Code (fw): Select all Collapse
//-------------- --------------------------------------------------------------//
  #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
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: TWebCam doesn't load driver when use with DIALOG
Posted: Mon Sep 01, 2014 08:47 AM

Thanks a lot Antonio,
Dutch

Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)

Continue the discussion