Page 1 of 1
Windows default beep on Alt+D
Posted: 10 Jun 2008 23:42
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
Re: Windows default beep on Alt+D
Posted: 11 Jun 2008 06:30
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
Re: Windows default beep on Alt+D
Posted: 11 Jun 2008 07:06
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...
If you (well, if the developer

) 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?
Re: Windows default beep on Alt+D
Posted: 11 Jun 2008 07:20
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

).
Re: Windows default beep on Alt+D
Posted: 11 Jun 2008 07:33
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

).
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.

Thanks anyway!
(Cool program, by the way...)
Posted: 11 Jun 2008 13:06
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.
Posted: 11 Jun 2008 13:19
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.
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...

Posted: 11 Jun 2008 13:48
by Mouse Potato
Success!!!
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!