Click to See Complete Forum and Search --> : [RESOLVED] Active Synch issue
Pasvorto
Sep 5th, 2007, 07:43 AM
Here is my situation...
I am implementing a new barcode scanner system. The one I am replacing is almost 10 years old and written in MCL 1.0. The new ones run Windows CE. I have a cradle that attaches to my PC vis USB. I have written the application in VB2005. Everything seems to work, so far.
Every scanner runs the same code. Therefore, it creates a file (on the scanner) with the same name ("scannerfile").
I can't seem to tell ActiveSynch where to place the file. It wants to put it in c:\documents and settings\my name\my documents\scanner my documents\scannerfile.
I can write my VB6 app on the PC to look for the file there. However, the next scanner gets in the cradle and it sends it to c:\documents and settings\my name\my documents\scanner1 my documents\scannerfile.
This may be the wrong place to ask, but it is Mobile Development. Is there a good technical document about ActiveSynch 4.5? If I could get all the scanners to "synch" their file to the same place, life would be much better for me.
petevick
Sep 5th, 2007, 07:54 AM
Hi,
so you are using activesync to transfer the files from different devices?
If so, I think it will do what you are seeing, to identify them differently, as it 'knows' they are from different devices.
You could handle it yourself using RAPI, or get your application on the PC to scan that particular folder, and remove the files when it has processed them.
RAPI would give you more control
Pete
Pasvorto
Sep 5th, 2007, 08:34 AM
RAPI? Never heard of it. I guess it is Google time again.
They are different physcial devices. 9 different scanners. I set the ActiveSynch to only update the PC. I was hoping that I would be able to synch to the same directory/filename on the PC. The filename is the same, it is the directory that I can't seem to change.
If I can't find a fix for it today, I will have to write my app to scan all the pertinent directories and process the file from there.
Another issue... From what I am reading, the Windows CE can only synch to 2 PCs (I am not synching email). I need to synch to my PC for testign purposes. The other PC is used by 3 shifts. They log on differently. Therefore, they will each use a different "My Documents" directory. This makes me think I need to set up a synch for each user. However, if I do that, will I be violating the 2 PC rule?
This would be so much easier if I could just access the mobile device directly from the PC app, or have the VB2005 app on the Windows CE device be able to copy the file to the PC. It just seems that programmatically, they can't see each other.
petevick
Sep 5th, 2007, 08:45 AM
Hi,
RAPI does exactly what you are trying to do.
There is an article here (http://www.devbuzz.com/content/zinc_eVB_copy_files_to_device_II_pg1.asp)showing you how to transfer a file, using VB6.
www.opennetcf.org have an opensource desktop library with a RAPI implementation allowing you to use RAPI in your .Net desktop application.
There is a VB6 sample in MSDN here (http://support.microsoft.com/kb/307256)
Alternately, FTP the file from the PPC to the PC.
Pete
Pasvorto
Sep 5th, 2007, 08:52 AM
RAPI sounds like it, from what I have been able to find. Now I need to find a sample of VB2005 using it to access a Windows CE5.0 device.
petevick
Sep 5th, 2007, 09:05 AM
Hi,
try http://www.opennetcf.org/permalink2.aspx?guid=f8ee4fda-ef74-4a0f-958f-70dc239443c2
You can always use one of the translators to translate the C# to VB
Pete
Pasvorto
Sep 5th, 2007, 10:13 AM
I did find a sample at
http://www.devbuzz.com/content/zinc_eVB_copy_files_to_device_II_pg1.asp
I am trying to 'massage' it so it will work in my environment. I am having a few issues, but I am making progress.
I plan on leaving this thread unresloved until I can have my VB6 app on my PC actually download the file from the scanner. Hopefully by the end of the day.
Thanks for all your help so far.
petevick
Sep 5th, 2007, 10:21 AM
Hi,
if you are using VB6 on the desktop, take a look at http://www.unsupportedsoftware.com/products/dev/vbrapi.htm
Pete
Pasvorto
Sep 5th, 2007, 10:23 AM
I am at the point where it wantrs to create a binary file. The original code says:
Open Form1.txtDesktopFile.Text For Binary As intFreeFileID
For intWriteLoop = 0 To lngBytesRead
Put #intFreeFileID, intWriteLoop + 1, bytBuffer(intWriteLoop)
Next intWriteLoop
I don't have a form1.textbox, so I used the scanner filename
Open "My documents\scannerfile" For Binary As intFreeFileID
For intWriteLoop = 0 To lngBytesRead
Put #intFreeFileID, intWriteLoop + 1, bytBuffer(intWriteLoop)
Next intWriteLoop
I get an error 183 as soon as it tries to execute the "Open..." statement.
183 seems to be a generic error. Any ideas?
petevick
Sep 5th, 2007, 10:28 AM
Hi,
"\My documents\scannerfile" ?? - note the 'leading slash'
Pete
Pasvorto
Sep 5th, 2007, 10:29 AM
I noticed that the file on the scanner was empty. So, I scanned a record and put it back on the cradle. It synched. Not it can't find the file.
here is the code:
Dim filename As String
filename = "My Documents\ScannerFile"
Dim intRetVal As Integer
intRetVal = CeRapiInit()
If intRetVal <> INIT_SUCCESS Then
MsgBox "Failed to initialise RAPI with device with error " & _
CeGetLastError
CeRapiUninit
Exit Function
End If
'locate the file, and see if it already exists on the device
lngFileHandle = CeFindFirstFile(filename, typFindFileData)
If lngFileHandle = INVALID_HANDLE Then
MsgBox "File " & filename & " Not Found. Operation Aborted.", vbOKOnly
CopyFileFromPocketPC = False
Exit Function
End If
I'm not sure what this is all about.
Pasvorto
Sep 5th, 2007, 10:31 AM
The code from the sample:
'locate the file, and see if it already exists on the device
lngFileHandle = CeFindFirstFile(Form1.txtPPCFile.Text, typFindFileData)
If lngFileHandle = INVALID_HANDLE Then
MsgBox "File " & Form1.txtPPCFile.Text & " Not Found. Operation Aborted.", vbOKOnly
CopyFileFromPocketPC = False
Exit Function
End If
petevick
Sep 5th, 2007, 10:32 AM
Are you still using activesync and RAPI - you need to turn off activesync for that file if that is the case
Pasvorto
Sep 5th, 2007, 10:37 AM
I tried "My Device\My Documents\ScannerFile"... Still file not found.
Pasvorto
Sep 5th, 2007, 10:39 AM
How do you turn off ActiveSynch? I unchecked the file synch check box
petevick
Sep 5th, 2007, 10:41 AM
Hi,
"\My Documents\Scannerfile" if "scannerfile" is the full name of your file.
The sample I pointed you at in the textbox has "\my documents\test.txt" or similar as the device file
Pasvorto
Sep 5th, 2007, 10:45 AM
I killed ActiveSynch and changed the file name back. I still get the file not found error. However, the scanner beeps now when I try to access it.
Pasvorto
Sep 5th, 2007, 10:47 AM
It quite beeping when I try to access it now. Very strange.
Pasvorto
Sep 5th, 2007, 10:49 AM
I don't see any mention of the version of Windows CE that this is for. I am using CE 5.0. Could that be an issue?
petevick
Sep 5th, 2007, 10:53 AM
Hi,
RAPI? Should work with any version.
I would quickly create a mickey mouse test file on the device, and try copying that up, and start from there. Or if you have VB6, try the sample from devbuzz - that is how I started using RAPI
Pete
Pasvorto
Sep 5th, 2007, 11:01 AM
I have a file on the device. I can copy it using Windows Explorer. I copied the sample and just modified the file name so that it is "hard coded" and not coming from a text box. I woudl think it should work. I will keep trying different things.
So, when I move this off my development PC and put it in to operation on a production PC, I don't want to install ActiveSynch. Is that correct?
petevick
Sep 5th, 2007, 11:56 AM
Hi,
I think you are ok with the RAPI library - I think :)
Pete
Pasvorto
Sep 5th, 2007, 12:20 PM
I tried the Microsoft MSDN version. However, it requires ActiveSynch.
Pasvorto
Sep 5th, 2007, 01:25 PM
ActiveSynch started really having issues. I rebooted the PC and now the file transfer program works. Weird.
Pasvorto
Sep 5th, 2007, 01:35 PM
Interesting. I downloaded the necessary RAPI library and used the sample code, which is now working. It requires ActiveSynch to be running, but the synch part turned off. I can live with that I guess.
The documentation says (about the RAPI library)
"This file is purely to assist developers, it does not need to be distributed with your projects."
However, when I compile it and copy the exe to a shared directory, the users get an error that they need to register RAPI.DLL
Am I missing something here?
Pasvorto
Sep 6th, 2007, 11:02 AM
I will just install RAPI.DLL on each and every PC and be done with it.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.