Il existe une solution sous Windows :
Code : Tout sélectionner
Global pvParam.i
;Si problème, remplacer pvParam.i par pvParam.l
; On interroge le système
If SystemParametersInfo_(#SPI_GETKEYBOARDCUES, 0, @pvParam, 0)
; Si Menu non souligné par défaut
If pvParam = 0
SystemParametersInfo_(#SPI_SETKEYBOARDCUES, 0, #True, 0) ; alors on force le soulignement
EndIf
If OpenWindow(0, 200, 200, 200, 100, "Exemple MenuItem")
If CreateMenu(0, WindowID(0))
MenuTitle("&Projet")
MenuItem(1, "Ouvrir") ; Elément normal
MenuItem(2, "&Enregistrer") ; Elément avec une lettre soulignée.
MenuBar()
MenuItem(3, "&Quitter"+Chr(9)+"ECHAP") ; Elément avec un raccourci clavier affiché sur la droite.
EndIf
Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
EndIf
;Debug pvParam
If pvParam = 0 ; Si Menu était non souligné par défaut, on rétablit le système
SystemParametersInfo_(#SPI_SETKEYBOARDCUES, 0, #False, 0)
EndIf
Else
MessageRequester("Attention", "Problème avec la fonction SystemParametersInfo")
EndIf
End
;=========== API WINDOWS ============
; http://msdn.microsoft.com/en-us/library/windows/desktop/ms724947%28v=vs.85%29.aspx
; BOOL WINAPI SystemParametersInfo(
; _In_ UINT uiAction,
; _In_ UINT uiParam,
; _Inout_ PVOID pvParam,
; _In_ UINT fWinIni
; )
;
; SPI_GETKEYBOARDCUES = $100A
; Determines whether menu access keys are always underlined.
; The pvParam parameter must point To a BOOL variable that receives TRUE
; If menu access keys are always underlined, And FALSE If they are
; underlined only when the menu is activated by the keyboard.
; SPI_SETKEYBOARDCUES = 0x100B
; Sets the underlining of menu access key letters.
; The pvParam parameter is a BOOL variable.
; Set pvParam To TRUE To always underline menu access keys,
; Or FALSE To underline menu access keys only when the menu is activated
; from the keyboard.
; SPI_SETMENUUNDERLINES = 0x100B
; Same As SPI_SETKEYBOARDCUES.
La fonction SystemParametersInfo_ permet de changer plein de réglages du système comme la vitesse de la souris, le contraste de l'écran (sous condition), etc.
M.