Author |
Topic: WM_CONTEXTMENU oddity (Read 794 times) |
|
rtr
Guest
|
 |
WM_CONTEXTMENU oddity
« Thread started on: Mar 18th, 2014, 4:23pm » |
|
Can I ask those of you who have written 'compliant' GUI applications to check what happens if the keyboard shortcut for the context menu (either Shift+F10 or the Menu key - usually to the right of the space bar) is pressed?
What I'm finding here is that under Windows 2000/XP/7 it works as expected and the WM_CONTEXTMENU message is generated (resulting in a popup menu, usually) but under Windows 8.1 the message is not generated!
I don't know if this is a Windows version thing or something specific to my PC, but I've put a workaround on the Wiki in case anybody else is similarly affected:
http://bb4w.wikispaces.com/Right-click+Context+Menu
Richard.
|
|
Logged
|
|
|
|
DDRM
Administrator
member is offline


Gender: 
Posts: 321
|
 |
Re: WM_CONTEXTMENU oddity
« Reply #1 on: Mar 19th, 2014, 10:13am » |
|
Hi Richard,
I don't have any such programs, but I wrote this to test:
Code:
*SYS1
ON SYS PROCdoSys(@wparam%,@lparam%,@msg%):RETURN
REPEAT
WAIT 1
UNTIL FALSE
END
:
DEFPROCdoSys(w%,l%,m%)
PRINT w%,l% AND &FFFF,l% >>>16,m%
ENDPROC
and it seems to do the right thing (reports a message of 123 for right-mouse clicks and menu button presses, with coordinates in lparam for mouse clicks and -1 for menu button), in both Windows 7 (64 bit) on my desktop and Windows 8 (not 8.1) on my laptop. The laptop is touchscreen, and touch-and-hold also reports like a mouse right-click.
Hope that's helpful.
D
|
|
Logged
|
|
|
|
rtr
Guest
|
 |
Re: WM_CONTEXTMENU oddity
« Reply #2 on: Mar 19th, 2014, 1:00pm » |
|
on Mar 19th, 2014, 10:13am, DDRM wrote:it seems to do the right thing (reports a message of 123 for right-mouse clicks and menu button presses |
|
What about Shift+F10? With your code I'm finding that, on my Windows 8.1 machine, the menu key does generate the expected message, but Shift+F10 doesn't! But now (after a reboot) my original program - which previously failed to respond to either Shift+F10 or the menu key, now responds to both!
So basically it's behaving inconsistently. I wonder if there's some 'race hazard' somewhere, but I don't really understand it at all. 
Richard.
|
|
Logged
|
|
|
|
DDRM
Administrator
member is offline


Gender: 
Posts: 321
|
 |
Re: WM_CONTEXTMENU oddity
« Reply #3 on: Mar 19th, 2014, 3:41pm » |
|
SHift-F10 does nothing on either machine - I tried it, and wondered whether the keyboard EITHER has the menu button OR uses shift-F10 as an equivalent, but it sounds like it isn't as simple as that!
Trying it in my PDF viewer (since it is open...), I see that it DOES respond to both the menu key and shift-F10, in the same way (puts the context menu in the top-left of the window), and to a right-click with a context menu at the site of the mouse. That's on the desktop in Win7. On the laptop, it's a horrible full-screen, windows8-ey version which does weird things, but the same for all 3 (bars appear at the top and bottom).
Word is similar (menu key and shift-F10 pop up the menu at the cursor), but right-click gives TWO pop-up menus!
Best wishes,
D
|
|
Logged
|
|
|
|
rtr
Guest
|
 |
Re: WM_CONTEXTMENU oddity
« Reply #4 on: Mar 19th, 2014, 6:58pm » |
|
on Mar 19th, 2014, 3:41pm, DDRM wrote:SHift-F10 does nothing on either machine |
|
That aspect of the mystery is solved - you won't see the message originating from Shift+F10 if the only window is the 'mainwin' (@hwnd%), which it is in your little test program. The reason I do see it in my application is that there's a child window (an edit control) which is evidently responding to Shift+F10 and sending the WM_CONTEXTMENU message to its parent window.
Richard.
|
|
Logged
|
|
|
|
|