This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: MSVC .rc files/EGCS(1.1)-Mingw32 bug?


Paul Garceau <pgarceau@teleport.com> wrote:

> I'm using Windres to convert a .rc file into something EGCS-Mingw32(1.1)
can
> understand (I hope).  I continue to get errors from "windres" with these
lines:
>
> (MSVC .rc script -- line 60)
> IDR_MAINFRAME ACCELERATORS MOVEABLE PURE
> BEGIN
>     "/",            ID_APP_ABOUT,           ASCII,  ALT, NOINVERT
>     "?",            ID_APP_ABOUT,           ASCII,  ALT, NOINVERT
> END
>
> MSVC resource header file:
> #define IDR_MAINFRAME                   2
> #define ID_APP_ABOUT 4
>
> Error from "windres" (included with Mingw32):
> "inappropriate modifiers for non-VIRTKEY".


The only documentation I can find right now for resource files is old 3.1
stuff, and it says:

  The ALT, SHIFT, and CONTROL options apply only to virtual keys.

Which would suggest a reason why that error is coming up. Probably this
restriction doesn't actually hold anymore (or never held?) but somebody
might have taken it to heart when writing windres. Also relevant to what you
are trying to do is this I think (under Type for the ACCELERATORS syntax):

  Virtual-key character
    An integer value representing a virtual key. The virtual key for
    alphanumeric keys can be specified by placing the uppercase
    letter or number in double quotation marks (for example, "9"
    or "C"). The type parameter must be VIRTKEY.

This implies, to me, that only alphanumerics or keys with VK_... key codes
can be used as virtual keys (and neither / nor ? has one.

However, I did some testing. First I tried

 "/", ID_TEST_DLG, VIRTKEY, ALT

This compiled without complaint. However, the / key didn't do anything, in
combination with alt or not. I figure that basically whatever algorithm is
used for translating literal characters into VK codes does not work for /...
probably because there is no VK code for /. On the other hand, in a flash of
crazyness I tried

 "/", ID_TEST_DLG, ASCII, ALT

Just like yours this reports "resources.rc:9: inappropriate modifiers for
non-VIRTKEY" when compiling. However, it *does* compile, and, even more
interestingly, it *does* work. If I press ALT and / together my test dialog
pops up. Adding

 "?", ID_TEST_DLG, ASCII, ALT

Makes it work for shifted / (?) as well, while reporting another 'error'.

In summary, those messages are warnings, not errors... probably this is
actually a good idea, because on other keyboard layouts the relationship
between / and ? might not be the same (they might not be on the same key for
example). I know this is true for other punctuation marks. (Quick, what
character comes from pressing shift on the ; key on a Japanese keyboard? No,
it's not a colon.)

So, while this works, it is not what I would call generally a Good Idea to
assign accelerators to punctuation characters.

Colin.

- Colin Peters - colin at fu.is.saga-u.ac.jp
- http://www.geocities.com/Tokyo/Towers/6162/index.html
- Go not to usenet for counsel, for it will say both
- 'yes' and 'no' and 'try another newsgroup'.


-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]