Windows default beep on Alt+D

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
Mouse Potato
Posts: 5
Joined: 06 Jun 2008 07:30

Windows default beep on Alt+D

Post by Mouse Potato »

Hi all,

I've assigned Alt+D as a keyboard shortcut to focus the Address bar. When I press it, the Address bar focuses nicely, but I then get a Windows default beep, which is not so nice.

I know I can use other key combinations, but the Alt+D combo is burned into my brain and my fingers and I don't want to change!

I noticed this on Vista -- Vista's totally unusable Windows Explorer is what set me hunting for an alternative -- but I've also tried it on an XP Pro machine and it does the same.

Is there any way to stop the default beep for this combination? (Other than by disabling the default beep altogether?)

Thanks in advance for any info!

MP

j_c_hallgren
XY Blog Master
Posts: 5826
Joined: 02 Jan 2006 19:34
Location: So. Chatham MA/Clearwater FL
Contact:

Re: Windows default beep on Alt+D

Post by j_c_hallgren »

Mouse Potato wrote:Is there any way to stop the default beep for this combination? (Other than by disabling the default beep altogether?)
Hi and welcome to the XY forums!

As I recall, when one uses "ALT" with a KS, the beep is pretty much a given...a quick search of forum gave me this older thread which I believe still applies: http://www.xyplorer.com/xyfc/viewtopic.php?t=434
Still spending WAY TOO much time here! But it's such a pleasure helping XY be a treasure!
(XP on laptop with touchpad and thus NO mouse!) Using latest beta vers when possible.

Mouse Potato
Posts: 5
Joined: 06 Jun 2008 07:30

Re: Windows default beep on Alt+D

Post by Mouse Potato »

j_c_hallgren wrote:Hi and welcome to the XY forums!

As I recall, when one uses "ALT" with a KS, the beep is pretty much a given...a quick search of forum gave me this older thread which I believe still applies: http://www.xyplorer.com/xyfc/viewtopic.php?t=434
Thanks for the welcome and the reply!

And I was afraid of that!

But there's probably a way around it. Involving a code change, of course... :wink:

If you (well, if the developer :D) can remove the relevant keystroke messages from the message queue after processing them, the beep won't happen. You have to do this on the WM_KEYDOWN message; WM_KEYUP is too late.

In Delphi a brute-force way of doing this is as follows (where hwnd is the handle of the form in question):

Code: Select all

while PeekMessage (TempMsg, hwnd, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE) do ;
while PeekMessage (TempMsg, hwnd, WM_COMMAND, WM_COMMAND, PM_REMOVE) do ;
I can successfully avoid the beep on Alt+D and any other key combinations I choose to support that don't have default handlers by doing that.

I haven't checked what XYplorer is written in -- except that it doesn't look like Delphi to me! -- but presumably something similar or better would be possible.

Could that be considered for a future release?

admin
Site Admin
Posts: 66083
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Windows default beep on Alt+D

Post by admin »

Mouse Potato wrote:I know I can use other key combinations, but the Alt+D combo is burned into my brain and my fingers and I don't want to change!
As jc said: no chance. Try the predefined Ctrl+Alt+A for "Focus Address Bar" -- it's not that bad... (and it's good brain gym to change once in a while :wink: ).

Mouse Potato
Posts: 5
Joined: 06 Jun 2008 07:30

Re: Windows default beep on Alt+D

Post by Mouse Potato »

admin wrote:As jc said: no chance. Try the predefined Ctrl+Alt+A for "Focus Address Bar" -- it's not that bad... (and it's good brain gym to change once in a while :wink: ).
My brain is already severely sprained from all the other keyboard navigation and shortcut differences between Vista and XP -- which I'm still using regularly on other machines -- so "no chance" right back at you. :wink: Thanks anyway! :D

(Cool program, by the way...)

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Post by TheQwerty »

It's not the ideal solution but take a look at AutoHotkey if you are not already familiar with it.

You could create a script that remaps Alt+D to Ctrl+Alt+A and perhaps avoid the beep.

Code: Select all

!d::SendInput ^!a

Mouse Potato
Posts: 5
Joined: 06 Jun 2008 07:30

Post by Mouse Potato »

TheQwerty wrote:It's not the ideal solution but take a look at AutoHotkey if you are not already familiar with it.

You could create a script that remaps Alt+D to Ctrl+Alt+A and perhaps avoid the beep.

Code: Select all

!d::SendInput ^!a
Thanks for the suggestion!

I think that general idea is the way to go, although I'd only want the remapping to take place if an XYplorer window had focus. I'm not familiar with AutoHotKey, but from a 5-second glance IfWinActive looks like a good place for me to start. Off to play with it now... :D

Mouse Potato
Posts: 5
Joined: 06 Jun 2008 07:30

Post by Mouse Potato »

Success!!! :D

The only tricky bit was finding the right type of conditional restriction.

In case anyone else ever needs it, this is what I used:

Code: Select all

SetTitleMatchMode 2
#IfWinActive XYplorer @
!d::SendInput ^!a
Thanks again, TheQwerty... much appreciated!

Post Reply