FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Pocket PC FWPPC and MC3000 scan button
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
FWPPC and MC3000 scan button
Posted: Sun Sep 09, 2007 05:33 AM

Hello,

I have upgrade to FWPPC August 2007 and I have created an application and transferred to the MC3000 unit. However, when I run the application the scan button does not work. I tried the demo software loaded on the unit and it works. Can someone tell me how I activate the scan button on the MC3000 unit or check for the scan button event?

Thank you very much.

Sincerely,

*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
FWPPC and MC3000 scan button
Posted: Sun Sep 09, 2007 11:19 AM

Hello,

I found the following code on this forum and got the scan button to work. However, the function is only returning the first character of the barcode. Can anyone help?

include "FWCE.ch"

include "hbclass.ch"

include "Directry.ch"

//----------------------------------------------------------------------------//
function Main()

local oDlg , ;
aGet1, aGet2, aGet3 , ;
cTitle := 'CDM WinWMS - Receipts' , ;
cBuild := 'Build 20070909-0109' , ;
cWmsdata := '' , ;
cOwner := SPACE(10) , ;
cPo := SPACE(30) , ;
cSku := SPACE(50) , ;
nQty := 0 , ;
cUnitId := SerialNumber()

// Database init...
REQUEST DBFCDX
REQUEST DBFFPT
RddSetDefault ('DBFCDX')

// Check connection...
IF ! FILE( "client.dbf")
DbCreate( "client.dbf", { { "data", "C", 50, 0 } } )
ENDIF

pfad := '\'
cDb := 'client'
USE (pfad+cDb) NEW SHARED
IF NETERR()
MsgAlert( 'Unable to open ' + pfad + cDb, cTitle )
RETURN (.F.)
ENDIF
IF client->( reccount() ) < 1
APPEND BLANK
ENDIF
GO TOP
cWmsData := ALLTRIM( client->data )
client->( dbclosearea() )

// Data Folder...
DO WHILE (.T.)
IF FILE(cWmsdata + "wmsdet.dbf")
EXIT
ELSE
cTmp = LEFT( cWmsdata + SPACE(50), 50)

    // Window Get...
    lPass := MsgGet( cTitle, "Folder Name", @cTmp )
    IF ! lPass
       RETURN (.F.)
    ENDIF

    // Init...
    cWmsdata = ALLTRIM(cTmp)
    IF RIGHT(cWmsdata,1)&lt;&gt;"\"
       cWmsdata += "\"
    ENDIF

    // Update...
    pfad := '\'
    cDb  := 'client'
    USE (pfad+cDb) NEW SHARED
    IF NETERR()
       MsgAlert( 'Unable to open ' + pfad + cDb, cTitle )
       RETURN (.F.)
    ENDIF
    GO TOP
    DO WHILE (.T.)
       IF client-&gt;( dbrlock() )
          client-&gt;data    := ALLTRIM( cWmsdata )
          client-&gt;( dbrunlock() )
          EXIT
       ENDIF
    ENDDO
    client-&gt;( dbclosearea() )
 ENDIF

ENDDO

DEFINE DIALOG oDlg TITLE cTitle ;
SIZE 300, 300 COLOR "W/B+"

@ 0.7, 01 SAY "Owner" SIZE 20, 10
@ 1.0, 05 GET aGet1 VAR cOwner SIZE 50, 10 PICTURE "@!" VALID CheckScan( @aGet1, @cOwner )

@ 1.7, 01 SAY "P.O. No." SIZE 25, 10
@ 2.0, 05 GET aGet2 VAR cPo SIZE 99, 10 PICTURE "@!" VALID CheckScan( @aGet2, @cPo )

@ 2.5, 01 SAY "SKU" SIZE 15, 10
@ 3.0, 05 GET aGet3 VAR cSku SIZE 99, 10 PICTURE "@!" VALID CheckScan( @aGet3, @cSku )

@ 3.5, 01 SAY "Qty" SIZE 10, 10
@ 4.0, 05 GET nQty SIZE 25, 10 PICTURE "999999"

@ 6.0, 01 BUTTON "Save" ACTION oDlg:End() SIZE 30, 10
@ 6.0, 10 BUTTON "Cancel" ACTION oDlg:End() SIZE 30, 10
@ 6.0, 19 BUTTON "New" ACTION oDlg:End() SIZE 30, 10

@ 8.0, 01 SAY cBuild SIZE 99, 10

ACTIVATE DIALOG oDlg CENTERED ;
VALID MsgYesNo( "Exit", cTitle )

return nil

//-----------------------------------------------------------------------------
FUNCTION CheckScan( oGet, cData )

LOCAL cRet , lReturn := .f., nLen := LEN( cData )

IF oGet:nLastKey = 13
cRet := SCAN_OPEN()
MsgInfo( cRet )
IF VALTYPE( cRet ) = 'C'
cData := LEFT( cRet + SPACE(nLen), nLen )
lReturn := .T.
ENDIF
ENDIF
oGet:Refresh()

RETURN (.T.)

//-----------------------------------------------------------------------------
FUNCTION cesetmenu() ; RETURN NIL
FUNCTION getmenu() ; RETURN NIL
FUNCTION readbitmap() ; RETURN NIL
FUNCTION palbmpread() ; RETURN NIL

pragma BEGINDUMP

pragma comment (lib,"scnapi32")

include <hbapi.h>

include <windows.h>

include "Scancapi.h"

LPSCAN_BUFFER lpScanBuffer = NULL;
BOOL bUseText = TRUE;
DWORD dwScanSize = 7095;
DWORD dwScanTimeout = 0;

define BUFFER_SIZE 7095

define DEFAULT_TIMEOUT 10000

HANDLE hScanner = NULL;
TCHAR szScannerName[MAX_PATH] = TEXT("SCN1:");
DWORD dwResult ;
CHAR Buffer ;
UINT uMsg ;
DWORD dwTimeout ;

HB_FUNC( SCAN_OPEN )
{
dwResult = SCAN_Open( szScannerName, &hScanner );
if ( dwResult == E_SCN_SUCCESS )
{
dwResult = SCAN_Enable( hScanner );
if ( dwResult == E_SCN_SUCCESS )
{

BOOL state = TRUE;
dwResult = SCAN_SetSoftTrigger(hScanner, &state);
if (dwResult == E_SCN_SUCCESS) {
// allocate a new scan buffer
lpScanBuffer = SCAN_AllocateBuffer(TRUE / data as chars /, BUFFER_SIZE);
if (lpScanBuffer) {
dwResult = SCAN_ReadLabelWait(hScanner, lpScanBuffer, DEFAULT_TIMEOUT);
if (dwResult == E_SCN_SUCCESS)
{
hb_retclen( (char *)SCNBUF_GETDATA(lpScanBuffer),25);
}
}
SCAN_DeallocateBuffer(lpScanBuffer);
}
state = FALSE;
SCAN_SetSoftTrigger(hScanner, &state);

}
else
{
MessageBox( GetActiveWindow(), L"Error en SCAN_Enable", L"Ok", 0 );

}
}
else
{
MessageBox( GetActiveWindow(), L"Error en SCAN_Open", L"Ok", 0 );
}
}

pragma ENDDUMP

*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
FWPPC and MC3000 scan button
Posted: Sun Sep 09, 2007 11:47 AM

Darrell,

Please try this and lets see what length you get:

cRet := SCAN_OPEN()
MsgInfo( Len( cRet ) )

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
FWPPC and MC3000 scan button
Posted: Sun Sep 09, 2007 06:23 PM

Antonio,

I changedn the CheckScan function to the following and it worked.

Regards,

FUNCTION CheckScan( oGet, cData )

LOCAL cRet , lReturn := .f., nLen := LEN( cData ) , ;
cTmp := '' , ;
cChar := '' , ;
cStr := 'ABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890' , ;
nX := 0

IF oGet:nLastKey = 13
cRet := SCAN_OPEN()
FOR nX=1 TO LEN( cRet )
cChar := SUBSTR( cRet, nX, 1 )
IF cChar $ cStr
cTmp += cChar
ENDIF
NEXT nX
cRet := cTmp
MsgInfo( Len( cRet ), cRet )
IF VALTYPE( cRet ) = 'C'
cData := LEFT( cRet + SPACE(nLen), nLen )
lReturn := .T.
ENDIF
ENDIF
oGet:Refresh()

RETURN (.T.)

*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
FWPPC and MC3000 scan button
Posted: Sun Sep 09, 2007 06:32 PM

Very good :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
FWPPC and MC3000 scan button
Posted: Mon Jun 23, 2008 02:26 AM

Antonio,

Is it possible to activate the SCAN_OPEN when a key is press on the scanner? The MC3000 has a yellow scan button, is sample code available that can handle such an event?

Thank you,

*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
FWPPC and MC3000 scan button
Posted: Mon Jun 23, 2008 07:40 AM

Darrell,

What control has the focus when the key is pressed ? The key event will go to the focused control, and in the case that there is no a control, it will be routed to the window or dialog.

Then you just need to implement:

<oControl_or_oWindow_or_oDialog>:bKeyChar = { | nKey | ... your code... }

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
FWPPC and MC3000 scan button
Posted: Mon Jun 23, 2008 01:38 PM

Hi Antonio, I tried this function but I get no response from the yellow key, I get responses from other keys.

*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
FWPPC and MC3000 scan button
Posted: Mon Jun 23, 2008 02:02 PM

Does the yellow button start a scan process ?

What your Pocket PC documentation comment about such button ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
FWPPC and MC3000 scan button
Posted: Wed Jul 16, 2008 03:22 AM

Hi Antonio,

Yes, the yellow trigger starts the scan process. I get no response with key function you provided. I am having a hard time finding good documentation for the scanner event handler. What is the best key words to search for such events?

Thank You,

*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
FWPPC and MC3000 scan button
Posted: Wed Jul 16, 2008 08:45 AM

Darrell,

Is this the documentation of your Pocket PC ?

http://74.125.39.104/search?q=cache:8PO ... gl=es#106

If yes, then I would review chapter 10 details.

&

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 682
Joined: Tue Feb 14, 2006 09:48 AM
FWPPC and MC3000 scan button
Posted: Wed Jul 16, 2008 09:18 AM

Hi Darrel,
In the past Symbol provides a application (ScanWedge.Exe), you can run this application on init of PocketPc, and when you press the yellow button the application will send the scaned code to the keyboard buffer.

Saludos desde Mallorca
Biel Maimó
http://bielsys.blogspot.com/
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
FWPPC and MC3000 scan button
Posted: Wed Jul 16, 2008 02:16 PM

Thank you, I will review documentation

*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
Posts: 42
Joined: Sun Oct 09, 2005 11:47 AM
FWPPC and MC3000 scan button
Posted: Thu Aug 14, 2008 07:19 AM

Hi Darryl,
I am yet to tackle the Symbol 9000 but have successfully programmed my system for the PSC Falcon 4400 using the API, which appears to be rather similar to Symbol.
Instead of waiting for a scan event, which I couldn't see how I could handle, I simply use a timer function, so that after issuing the scan request it periodically checks for any data, say every 500 msecs. Disable the timer while processing the scanned data and enable when ready to request the next scan. Whenever a scan occurs, the data will be detected in the next cycle. On the Falcon 4420 it works very well and long complex EAN128 barcodes can be scanned, decoded and parsed at 2 per second! Because the scanner is buffered, none are ever lost but just wait in the queue.
I also tried the standard 'keyboard wedge' function but found it to be so slow as to be totally unacceptable, probably caused by the character by character processing and barcodes over 50 digits.
I'll be tackling the Symbol industrial scanners soon...

HTH

Continue the discussion