Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

barcode scanning 1

Status
Not open for further replies.

ketankshah

IS-IT--Management
Jan 11, 2001
121
IN
I want a component which can scan barcode on a PocketPC running on Windows CE. If anybody has the code as well as the component please send me or if someone can give me the link where can I find it.

Please Help!!!!

Ketan
 
Hi Ketan!

I recently have been having problems with scanning barcodes as well. I am using a Symbol PPT2700 so to get the barcode scanning working i downloaded the SDK from the symbol website, under services and downloads ( I think you have to sign up to the developer zone to download stuff from this site) When you run the .exe file it will install an activescan.dll which will allow you to add a scan control to your forms! Might need to add it through references and components in the project options if it doesn't add it automatically.
On the form you must enable ,open and close the scanner when it is not is use so i have this code on my form and u will be able to use it like any other control(ScnBarcode is the name of the control)

Private Sub Form_Activate()
ScnBarcode.OpenScanner
ScnBarcode.EnableScanning (True)
End Sub

Private Sub Form_Deactivate()
ScnBarcode.EnableScanning (False)
ScnBarcode.CloseScanner
End Sub

Hope this helps you some bit and is explained ok!!!
:)



 
Thank you very much for your detailed reply. I will definitely download the component and try it. In case I have any problem, I will get back to you.

Thanks again.

Ketan
 
Ketan,

The Symbol API is nice, but I would be wary of it's use as it makes you hardware dependent - e.g. Unless you modify the code and remove the control from the projects, you won't be able to use the CE program on another device (Jornada, iPaq, Intermec, etc.) Secondly, Symbol makes more then one decive for scanning in CE. In fact, they have two other devices that act as add-ons to other CE devices. One is the SPS3000, and the other is sold by a company called Socket Devices (the "In-Hand" scanner). All three use the EXACT same bascis API engine to scan information. The only difference is implementation. The PPT devices already have a button that initiates the scanner, the others require a software trigger to run.

Now, if you're not adverse to writing a small C/C++ program, you can implement a "one size fits all" solution for your scanning needs by writing a DLL or separate EXE file to access the API directly.

If you'll notice in the \Windows directory on your handheld, there is an API called SCNAPI32.DLL. This is the scan engine that the Symbol API interfaces with to access the scanner. It exports a buch of functions that you can use to access the scanner. These are as follows:

LPSCAN_BUFFER_W (CALLBACK *SCAN_AllocateBuffer_W)(BOOL bText,DWORD dwSize);
DWORD (CALLBACK *SCAN_DeallocateBuffer_W)(LPSCAN_BUFFER_W lpScanBuffer);
DWORD (CALLBACK *SCAN_FindFirst_W)(LPSCAN_FINDINFO_W lpScanFindInfo,LPHANDLE lphFindHandle);
DWORD (CALLBACK *SCAN_FindNext_W)(LPSCAN_FINDINFO_W lpScanFindInfo,HANDLE hFindHandle);
DWORD (CALLBACK *SCAN_FindClose)(HANDLE hFindHandle);
DWORD (CALLBACK *SCAN_Open)(LPCTSTR lpszDeviceName,LPHANDLE lphScanner);
DWORD (CALLBACK *SCAN_GetVersionInfo)(HANDLE hScanner,LPSCAN_VERSION_INFO lpScanVersionInfo);
DWORD (CALLBACK *SCAN_Close)(HANDLE hScanner);
DWORD (CALLBACK *SCAN_Enable)(HANDLE hScanner);
DWORD (CALLBACK *SCAN_Disable)(HANDLE hScanner);
DWORD (CALLBACK *SCAN_ReadLabelEvent_W)(HANDLE hScanner,LPSCAN_BUFFER_W lpScanBuffer,HANDLE hEvent,DWORD dwTimeout,LPDWORD lpdwRequestID);
DWORD (CALLBACK *SCAN_ReadLabelMsg_W)(HANDLE hScanner,LPSCAN_BUFFER_W lpScanBuffer,HWND hWnd,UINT uiMsgNo,DWORD dwTimeout,LPDWORD lpdwRequestID);
DWORD (CALLBACK *SCAN_ReadLabelWait_W)(HANDLE hScanner,LPSCAN_BUFFER_W lpScanBuffer,DWORD dwTimeout);
DWORD (CALLBACK *SCAN_CancelRead)(HANDLE hScanner,DWORD dwRequestID);
DWORD (CALLBACK *SCAN_Flush)(HANDLE hScanner);
DWORD (CALLBACK *SCAN_GetSoftTrigger)(HANDLE hScanner,LPBOOL lpSoftTrigger);
DWORD (CALLBACK *SCAN_SetSoftTrigger)(HANDLE hScanner,LPBOOL lpSoftTrigger);
DWORD (CALLBACK *SCAN_GetDeviceInfo)(HANDLE hScanner,LPDEVICE_INFO lpDeviceInfo);
DWORD (CALLBACK *SCAN_GetSupportedDecoders)(HANDLE hScanner,LPDECODER_LIST lpDecoderList);
DWORD (CALLBACK *SCAN_GetEnabledDecoders)(HANDLE hScanner,LPDECODER_LIST lpDecoderList);
DWORD (CALLBACK *SCAN_SetEnabledDecoders)(HANDLE hScanner,LPDECODER_LIST lpDecoderList);
DWORD (CALLBACK *SCAN_GetDecoderParams)(HANDLE hScanner,LPDECODER lpDecoder,LPDECODER_PARAMS lpDecoderParams);
DWORD (CALLBACK *SCAN_SetDecoderParams)(HANDLE hScanner,LPDECODER lpDecoder,LPDECODER_PARAMS lpDecoderParams);
DWORD (CALLBACK *SCAN_GetUPCEANParams)(HANDLE hScanner,LPUPC_EAN_PARAMS lpUPCEANParams);
DWORD (CALLBACK *SCAN_SetUPCEANParams)(HANDLE hScanner,LPUPC_EAN_PARAMS lpUPCEANParams);
DWORD (CALLBACK *SCAN_GetReaderParams)(HANDLE hScanner,LPREADER_PARAMS lpReaderParams);
DWORD (CALLBACK *SCAN_SetReaderParams)(HANDLE hScanner,LPREADER_PARAMS lpReaderParams);
DWORD (CALLBACK *SCAN_GetInterfaceParams)(HANDLE hScanner,LPINTERFACE_PARAMS lpInterfaceParams);
DWORD (CALLBACK *SCAN_SetInterfaceParams)(HANDLE hScanner,LPINTERFACE_PARAMS lpInterfaceParams);
DWORD (CALLBACK *SCAN_GetScanParameters_W)(HANDLE hScanner,LPSCAN_PARAMS_W lpScanParams);
DWORD (CALLBACK *SCAN_SetScanParameters_W)(HANDLE hScanner,LPSCAN_PARAMS_W lpScanParams);
DWORD (CALLBACK *SCAN_GetScanStatus)(HANDLE hScanner,LPSCAN_STATUS lpScanStatus);
DWORD (CALLBACK *SCAN_RegisterScanMessage)(HANDLE hScanner,HWND hWnd,UINT uiMessage);
DWORD (CALLBACK *SCAN_DeregisterScanMessage)(HANDLE hScanner);
DWORD (CALLBACK *SCAN_DoRemoteFeedback)(HANDLE hScanner,LPFEEDBACK_PARAMS lpFeedbackParams);
DWORD (CALLBACK *SCAN_Ioctl)(HANDLE hScanner,DWORD dwIoctlCode,LPVOID lpvInBuf,DWORD dwInBufSize,LPVOID lpvOutBuf,DWORD dwOutBufSize,LPDWORD lpdwActualOut);


Note that I load the DLL explicitly (I don't let the system do it for me, or create the thunks during the link phase of building my C/C++ program), and import all of the functions into my routine via the LoadLibrary() API routine. So they look a little strange.

The basic process is this:
1) Call the SCAN_Open() function to access the scanner. You can used "SCN:" as the port name (this is the default scanner known by the CE device). This function returns back a scanner handle.

2) call the SCAN_Enable() to tell the scanner that it will be used for scanning.

3) call SCAN_AllocateBuffer() to allocate memory to store the scan results.

4) Call SCAN_ReadLabelMsg() to start the scan beam. This function requires the scanner handle, the allocated buffer gotten from SCAN_AllocateBuffer(), a windows message to return to the window when the scan is complete, and a timeout value (to turn off the beam).

5) When the scan is complete, the Windows Message passed in the SCANReadLabelMsg() function will be triggered, and the lParam of the message will contain the results of the scan (the text data).

6) The buffer must be analysed to get the status code, but at this time, you can pass this information back to your program.

7) Use SCAN_Disable() to disconnect from the scanner.

8) Use SCAN_Close to close the scanner, and then you're done.


Note, that some sample code can be found with the SPS3000 developer's API, which gives a better illustration then I have done here. ALl in all, it took me a week to research, develop, and test. Low and behold, it workd for all three.

Hope this helps.

 
I've been able to get my Symbol 2700 to scan 2D barcodes through the demo application...but I simply want to be able to store the information sequentially in any type of file whatsoever to retrieve later.

Any ideas how I can do this?
 
369852, That worked perfect

Thanks a million
How 'bout a star DougP, MCP
 
Hi,
I dont have a PPT2700/2800 yet, but I guess, that I have to programm some stuff for one.
What do I have to do, to intercept "hard triggered" scans? I mean scans triggered by pressing the "scan button".
Do I have to set the SCAN_ReadLabelEvent?

Thanks for any help

Alexander
 
If you want to intercept "hard triggered" scans, you would set up for that by calling:

SCAN_ReadLabelMsg(...)
 
Hi, I have to make a programm to scan barcodes as you said. So I think I must download SDK but on Symbol web site, there a a lot of SDK (Cyberpen, CD2000,...). Which one have I to download?
My pocket PC is that one :

Also, someone perhaps could send me a program he did to see what it looks like.

Plase!!!!!
Thank you for your help.
 
I think I found the SDK. But when I write the funcion "SCAN_Open" in my application, the compilator does not know it. How have I to do to include the .dll in my project?
 
hi... i'm new and got a symbol ppt 2700 too! pls. help! whats the sdk file name on symbol site that i could download? there are several sdk types so pls let me know. I want to enable too the barcode scanner on my ppt 7200!!!

thanks...
dodi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top