tags:

views:

285

answers:

2

By default Windows (XP) shows the underlined hotkeys only, when ALT is pressed. This can be changed in display-properties in the subdialog "Effects" so, that the hotkeys are always underlined

How can it be changed programmatically? Which API-call or registry-setting can be used to change this setting?

+2  A: 

Do you mean you want to change this system-wide setting, or that you want to be able to override the behavior only in your program?

If it's the latter and you're using the Win32 API, it looks like you might be able to catch the WM_CHANGEUISTATE notification: http://blogs.msdn.com/oldnewthing/archive/2005/05/03/414317.aspx I've not tried it myself but it seems feasible.

If it's the former you're aiming for, I've not yet been able to discover a method.

Mentat
Actually it's pretty easy, but you don't have to *catch* WM_CHANGEUISTATE, you have to *send* it to your window : `SendMessage(hWnd, WM_CHANGEUISTATE, UISF_HIDEACCEL << 16 | UIS_CLEAR, 0);`. Thanks, I spent almost 2 hours looking for that !
Thomas Levesque
+3  A: 

I found the solution, how to query and to set:

BOOL b
SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &b, 0);
if (!b) {
    b = TRUE;
    SystemParametersInfo(SPI_SETKEYBOARDCUES, 0, &b, 0);
}
Christof Schardt