Windows CE (Or: I'm out of my depth)
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Windows CE (Or: I'm out of my depth)

  1. #1
    Join Date
    Jun 2010
    Posts
    2

    Windows CE (Or: I'm out of my depth)

    Hi everyone. I was doing a favor for *person* who is blind. She likes to read books, and uses a braille reader thing. It converts .rtf files into Braille so she can read them. However, *book publisher* recently changed the way they encode their .rtf files, which breaks the converter. It's a pretty simple fix, so I wrote a program to do it. It works fine, but I didn't realize that her reader ran on Windows CE.

    I looked online to see how to re-write the program to work on Windows CE, but I have next to no practical programming experience. Most of the information assumed that I knew quite a lot about programming, and I have no clue what it's telling me to do.

    I'm asking so that someone can take my code and re-do it for Windows CE, so that I may send it on. It's very simple, just over 100 lines of code. It uses the Windows API to find all the .rtf files in the current folder (where the .exe is located), and reads each character and puts it into a new file. If the character is a backslash, then it checks the next character. If it's not a lowercase letter, or one of the exceptions, it adds the letters "par" after it, to indicate the paragraph break. Then, once the whole file has been transferred into the new one, it deletes the old one, and renames the new file to match the old.

    Anywho, the program is commented reasonably well, so it shouldn't be all that hard to figure out which does what. There may be a better way to do this, so if you want to fix that while you're at it (though why would you?) you can. It just needs to have the same results, and work on Windows CE.

    I thank all of you for your help.
    Attached Files Attached Files

  2. #2
    ovidiucucu's Avatar
    ovidiucucu is offline Moderator/Reviewer Power Poster
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,060

    Re: Windows CE (Or: I'm out of my depth)

    Visual Studio 2005/2008/2010 come with Pocket PC and Smartphone emulators so a Windows CE application can be easily tested under desktop Windows. If you don't have yet one, you can get a 30-days trial version of Microsoft Visual Studio 2010 Ultimate then test yourself the program.

    However, here are few observations about your code:

    Windows CE supports only the UNICODE API functions (see this FAQ).
    So, as an example, if compile for WinCE platform, next line
    Code:
    HANDLE hFind = FindFirstFile((LPCSTR)"*.rtf", &findFileData); // note, here (LPCSTR) cast is useless
    will get an error (UNICODE is obviously defined for WinCE target), and has to be replaced with
    Code:
    HANDLE hFind = FindFirstFile(L"*.rtf", &findFileData); // this compiles for UNICODE
    or
    Code:
    HANDLE hFind = FindFirstFile(_T("*.rtf"), &findFileData); // this compiles both for ANSI and UNICODE
    Further, you may have to use the UNICODE version of STL classes (wstring, wcout, and so on) for consistency and to avoid conversion functions like mbstowcs or wcstombs.
    Also may be necessary to use wchar_t (or TCHAR) instead of char type, UNICODE version of CRT functions, and so on.
    And beware of how data is stored in the files (ANSI or UNICODE).

    Just a little bit to sweat...
    Last edited by ovidiucucu; June 13th, 2010 at 08:05 AM.
    Ovidiu Cucu
    "When in Rome, do as Romans do."
    My likes on StumbleUpon
    Visit: Microsoft Virtual Academy
    Follow: https://twitter.com/#!/ovidiucucu
    My blog: http://codexpert.ro/blog/author/ovidiu-cucu/

  3. #3
    Join Date
    Jun 2010
    Posts
    2

    Re: Windows CE (Or: I'm out of my depth)

    Ok, I think I've managed to re-write this properly. However, I can't make either the downloadable emulator, or the one in Visual Studio 2010 work, so I can't test it.
    I'm uploading my new version, code and .exe forms.
    Thank you for your help.
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center