|
|
|
|
|
|
|
|
HP hotkeys, OK buttons, and file existence (continued)
How do I test for the existence of a file on my Windows CE device, even if it's in ROM? The standard method of testing for a file's existence is to attempt to open it in shared, read-only mode and test for a valid handle. Due to the way that the Windows CE file storage is structured, this method won't work on executable modules that are in ROM. The right way to do this is to use the GetFileAttributes API (application programming interface). If 0xFFFFFFFF is returned, the file doesn't exist. If the file does exist, the value contains some interesting information. Windows CE utilizes the following three new attributes to describe files in ROM:
- FILE_ATTRIBUTE_INROM: lets you know that the file is part of the read-only OS image and can't be updated.
- FILE_ATTRIBUTE_ROMMODULE: also means that the file is in ROM, but additionally that it's a binary image such as a DLL (data link layer) or an .EXE file. Files with this attribute will be executed directly from ROM instead of first being copied to RAM. This feature is referred to as execute in place (XIP) in some of the documentation and literature on Windows CE.
- FILE_ATTRIBUTE_ROMSTATICREF: specifies that the file is a DLL that's statically linked to at least one other ROM module and cannot be replaced by a file of the same name in a different directory.
How do I get a listview to select a whole row at a time instead of just the first column? If you've been using the Win32 listview control on the desktop or Windows CE for a while, you've no doubt run across this question. Earlier versions of the control didn't provide the functionality at all, and Microsoft supplied a detailed example program that showed how to hack in support for it. This was a major kludge, and Microsoft redeemed itself by adding in support in later versions. It isn't turned on by default, but if you execute the following statement to your handler for the WM_INITDIALOG message you won't have to go through any kludgy gyrations.
ListView_SetExtendedListViewStyleEx(hwndLV,
LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT);
|
That about wraps it up. See you next month. Be sure to keep those questions coming to poweranswers@bsquare.com.
Product Availability and Resources Full source code for the extended editor, which looks a lot like the stock editor provided by HP, is available at http://www.halcyon.com/ast/dload/HotKeyEditor.zip.
Bulk reprints Bulk reprints of this article (in quantities of 100 or more) are available for a fee from Reprint Services, a ZATZ business partner. Contact them at reprints@zatz.com or by calling 1-800-217-7874.
|
Andrew Tucker works on developer tools for Windows CE at bSQUARE Corporation. He has been writing code for Windows since 1991 and has published articles in C/C++ Users Journal, Dr Dobbs Journal, and Windows Developer Journal. He recently co-authored SAMS Teach Yourself Windows CE Programming in 24 Hours. Andrew has a BSCS from Seattle Pacific University and is working on a MSCS at the University of Washington. He can be reached at poweranswers@bsquare.com.
|
|
|
|
|
|
|
|
|
|
|