PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → Zebra Windows SDK, Barcode Scanning Callback
Zebra Windows SDK, Barcode Scanning Callback
Débuté par Riebens, 12 déc. 2024 15:33 - 7 réponses
Membre enregistré
85 messages
Posté le 12 décembre 2024 - 15:33
Hi All

I need help finding the correct method to call to register a callback event for the barcode scanning.

There is a Callback registered in Visual Studio for Scanning:
// Add barcode data event handler
coreScannerObject.BarcodeEvent += CoreScannerObject_BarcodeEvent;

In Visual Studio the Code is: ( shortened)

// Initialize CoreScanner COM object
CoreScanner.CCoreScanner coreScannerObject = new CCoreScanner();
// Open CoreScanner COM Object
coreScannerObject.Open(appHandle, // Application handle
scannerTypes, // Array of scanner types
NumberOfScannerTypes, // Length of scanner types array
out status); // Command execution success/failure return status
// Call register for events
coreScannerObject.ExecCommand(opCode, // Opcode: Register for events
ref inXml, // Input XML
out outXml, // Output XML
out status); // Command execution success/failure return status
// Add barcode data event handler
coreScannerObject.BarcodeEvent += CoreScannerObject_BarcodeEvent;

In WinDev I have :
// Initialize CoreScanner object
MyRfIdReader is CCoreScannerClass
// Open CoreScanner Object
MyRfIdReader.Open(0,arrScannerTypes,nNumberOfScannerTypes,nStatus)
// Call register for events
MyRfIdReader.ExecCommand(nOpCode,pInXml,pInXml,nStatus)
// Add barcode data event handler
MyRfIdReader.add_BarcodeEvent(DotNetDelegate("CoreScannerObject_BarcodeEvent","_ICoreScannerEvents_BarcodeEventEventHandler"))

My Problem is that coreScannerObject.BarcodeEvent += CoreScannerObject_BarcodeEvent; does not work in WinDev, so I tried the find the BarcodeEvent Propperty filling Event, but it seems to be virtual Classes, and I cannot seem to Find The correct one to use.

coreScannerObject.BarcodeEvent seems to point to event _ICoreScannerEvents_BarcodeEventEventHandler BarcodeEvent.

I tried using "_ICoreScannerEvents_BarcodeEventEventHandler" but there are many methods to call, and most of them also seems virtualized.

I need help with which method to call to actually register a callback for when barcodes are scanned ( as a non .NET developer)

Kind Regards

--
Ben Dell
Riebens Computers Pty Ltd
Southern Africa PcSoft Distributor
www.windevsa.co.za
PcSoft Sales, Support and Training
Membre enregistré
85 messages
Posté le 12 décembre 2024 - 15:54
Further

If I try
PRS is _ICoreScannerEvents_BarcodeEventEventHandler dynamic
MyRfIdReader.BarcodeEvent += PRS.Equals("CoreScannerObject_BarcodeEvent")

I get the error:
Dynamic .NET object 'PRS' not created.

And the Programname.dll is not compiled

Kind regards

--
Ben Dell
Riebens Computers Pty Ltd
Southern Africa PcSoft Distributor
www.windevsa.co.za
PcSoft Sales, Support and Training
Membre enregistré
177 messages
Posté le 12 décembre 2024 - 18:51
Hello

I see your problem, you want to scan a barcode from an application, I have a solution for you

1. You will need to save a photo, then you scan this photo

You will need to code this program which you can use

// EDD (12/24): You will need to create four fields
// EDD (12/24): Two button fields: New | Scan
// EDD (12/24): One barcode field: CDB
// EDD (12/24): One image field

// EDD (12/24): New button click event
LOCAL
cbCode is CodeBarres
dhDay_Hour is DateHeure
sString is string
sRepertoire is string = fRepExe() + "\Barcode"
IF fRepExiste(sRepertoire) = False THEN
fRepCrée(sRepertoire)
END
//1 : Description
//2 : Annuler
SELON Saisie("Enter the description barcode please.", sString)
CAS 1 : // Description
IF NoSpace(sString) = "" THEN
Info("The barcode is empty.")
RETOUR
END
CAS 2 : // Annuler
Info("You are cancel the barcode.")
RETOUR
FIN
dhDay_Hour = DateHeureSys()
cbCode..Contenu = sString
cbCode..TypeContenu = cbTypeTexte
cbCode..TypeCodeBarres = CB_CODABAR
CDB = cbCode
IF dSauveImagePNG(CDB, sRepertoire + "\Scan_" + Left(dhDay_Hour, 14)) = False THEN // EDD (12/24) : Information save "...\Code_Barre\Scan_20241212201400.png"
Info(ErreurInfo(errComplet))
ELSE
Info("The barcode is save in the database.")
END

EDD (12/24): Scan button click event
LOCAL
sDossier is string
sRepertoire is string = fRepExe() + "\Barcode"
IF fRepExiste(sRepertoire) = False THEN
fRepCrée(sRepertoire)
END
sDossier = fSélecteur(sRepertoire, "Fichier.png", "Sélectionner the picture", "Fichier picture (*.PNG)" + TAB + "*.png", "png")
IMG_Barcode = ""
IF sDossier <> "" THEN
IMG_Barcode = sDossier
END

NB : webographie : https://translate.google.com/

Best regards
Mr.RATSIMANDRESY
Niry Aina Eddy
Membre enregistré
177 messages
Posté le 12 décembre 2024 - 18:54




: Barcode Backup Reading





: Barcode Scan Reading
Membre enregistré
85 messages
Posté le 13 décembre 2024 - 08:21
Dear Mr.RATSIMANDRESY

The question was a specific callback issue with Zebra Core Scanner .NET module for RFID scanning.

Kind Regards

--
Ben Dell
Riebens Computers Pty Ltd
Southern Africa PcSoft Distributor
www.windevsa.co.za
PcSoft Sales, Support and Training
Membre enregistré
177 messages
Posté le 13 décembre 2024 - 16:00
Hello

I see your request, I do not know how to code on the .NET language so I cannot give a solution on .NET, but I gave you a solution in WLanguage which is already operational

I could give you a solution on WLanguage on barcodes, I mean on the creation of barcodes up to the scan

NB: You will have to choose between the Windows platform and between the mobile platform

Best Regards
Mr.RATSIMANDRESY
Niry Aina Eddy
Posté le 24 janvier 2025 - 11:37
Hello,

Can I also use this in Windev Mobile version 24 (not version 2024 but certainly 24)

Thanks.

Willy
Posté le 29 janvier 2025 - 20:38
Feedback :

Ended up having some C# code in the procedure doing the callback where DotNetDelegate() failed to compile, the c# code compiles...

Kind Regards

Ben