delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/10/23/17:33:30

From: colin AT fu DOT is DOT saga-u DOT ac DOT jp (Colin Peters)
Subject: RE: MSVC .rc files/EGCS(1.1)-Mingw32 bug?
23 Oct 1998 17:33:30 -0700 :
Message-ID: <000e01bdfe21$d97bff80$fa173185.cygnus.gnu-win32@gbird0.fu.is.saga-u.ac.jp>
Mime-Version: 1.0
To: <pgarceau AT teleport DOT com>
Cc: "GNU-win32" <gnu-win32 AT cygnus DOT com>

Paul Garceau <pgarceau AT teleport DOT 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 AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019