分享

回忆Backtrack【转】

 昵称14815498 2013-11-27

CEStuff.NET

It's not big, and it's not clever, like a dwarf with learning difficulties. But it's altruistic.

I had the misfortune to have to learn .NET, C#, eVC and build and program a CE handheld from scratch in a couple of months. I only had knowledge of C/C++ and Visual Studio. The information I have had to find out for myself and which sometimes took a heck of a time to search out is here.

I hope it is of use to someone. I wish it had been here for me.

You don't have to register to find the solution. I hate that.

You don't have to suffer people who know little, if anything, more than you moaning about top-posting and asking if you've turned the machine on. I hate that.

You don't have to send your email address. I hate that.

If you have anything to add, something which took you a while to work out and you want to share it, please feel free to email me at paulATbacktrackDOTorg. No spam, please. And if you have any questions which are proving a problem, let me have them too please, I'll post them below and we'll see if we can get the answers. That will make it all worthwhile.

Getting started:

First find your handheld device. Mine needed a barcode reader and WiFi, and needed to be ruggedised. The only reasonable priced one off-the-shelf was a PD264B/PD264XB from an Italian company, EIA, but it is flimsy and fails a lot. It had CE4. I won't list ALL the bad bits, if you want something really cheap and worth what you pay, get one. You will have to pay up front.

For the same money, we commissioned a company in the US to produce one for us, based on their existing ruggedised machine. The machine is superb and can be bought from envigour systems, based in Stirling, Scotland, UK. www.. Go there first. It's CE5 too, which is nice.

From experience, it's more cost-effective to get nearly what you want and then alter it by adding components. You need to know a bit about electronics and/or interfacing and/or driver writing. But it's not hard.

The stuff you need:

You will need a decent setup to start programming your handheld. A PC with plenty of spare space for all the development software and service packs, look for around 20Gb of spare disk. And at least 1280 x 1024 resolution. And a good processor. And USB 2.

If you are going to be messing about at the hardware/driver level, you will need eVC4 (http://www.microsoft.com/downloads/details.aspx?familyid=1DACDB3D-50D1-41B2-A107-FA75AE960856&displaylang=en) and note the CD key at the bottom of that page, with SP4 (http://www.microsoft.com/downloads/details.aspx?FamilyID=4a4ed1f4-91d3-4dbe-986e-a812984318e5&displaylang=en). Load these two first, in that order.

If you load any other SDKs, for instance from a manufacturer, load them afterwards or they won't be available.

Obviously you can program your handheld now, in C/C++, the hard way. But if you want to use a higher-level language like VB or C#, you will need Visual Studio.NET. That costs a fortune, but that's the way it is.

You also need a version of toolhelp.dll for the handheld. It comes with most MS stuff, and is found by traipsing up the directories they install until you find it. Make sure it is for the right processor, we used a Samsung and an Intel ARMV4T-compatible which seems pretty much par for the course.

Connecting the Handheld

Usually you'll connect the Handheld via USB. That will need ActiveSync. SOME Handhelds, many in fact, won't install with ActiveSync higher than 3.5, so it might be worth loading that first, it ships with the Handheld. The latest at the time of writing is 3.7.1, again available from Microsoft on http://www.microsoft.com/windowsmobile/downloads/activesync37.mspx.

You also need the drivers for the Handheld, usually wceusbsh.inf and wceusbsh.sys (they come with the Handheld, nobody else's driver will work, usually), then having installed ActiveSync plug the USB connection to the Handheld and it will be installed for you. Point the New Hardware Wizard to the INF file when asked.

If you're using .NET, once you have done this, you will need to import keys to the registry because there is a bug (http://support.microsoft.com/default.aspx?scid=kb;en-us;813579) in .NET. The ProxyPorts.reg file is found at C:\Program Files\Microsoft Visual Studio .NET 2003\CompactFrameworkSDK\
WinCE Utilities\WinCE Proxy Ports Reg\ProxyPorts.reg. Just run it. And do it every time you have to reload ActiveSync.

If you're using eVC4 and you have any sort of Firewall like Norton or XP Pro's built in job, you need to let ActiveSync use some ports. Microsoft say they need 990, 999, 5678 and 5679 but enabling them didn't work for me. I had to disable the firewall. If anyone knows why I would love to hear about it.

Many Handhelds don't reconnect ActiveSync when you suspend/resume. Most will reconnect when you reset the Handheld. If this doesn't work, unplug the USB and plug it in again.

Programming with eVC4

No problems here, unless you're using eVC to write DLLs to do things that C# won't let you do. Passing parameters between eVC and C# (or VB) is normally very easy, you can use ref Int32, or return an Int32 value or whatever. But if you want anything of a decent size you will need some sort of referenced array. My favourite has been a TCHAR * so I can get any amount of stringy data back, for instance from a barcode scan, back to the C# app.

It's done easily, like this ...

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多