--
Cordialement
Christophe Charron
--
Article posté depuis le site FORUMS WINDEV® :
http://windev.wdscript.com
Une archive de plus de 75000 articles sur Windev® et Webdev®
--
Ou
l'api
AppelDll32("USER32","RegisterHotKey",_HandleWnd,HKFAR_SUPPR,MOD_CTL,VK_DELETE)
combiné à un _EvtHotKey = Evenement("CtrlHotKey","FK_PTGE",WM_HOTKEY)
PYT
"Christophe Charron" <christoph...@prologiq.fr> wrote in message
news:29B00042482000...@windev.wdscript.com...
> Bonjour,
> presque tout est dans l'objet. Je voudrais une méthode pour intercepter
> ces combinaisons sans passer par 26 boutons.
>
> --
> Cordialement
> Christophe Charron
--
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG
The RegisterHotKey function defines a hot key for the current thread.
BOOL RegisterHotKey(
HWND hWnd, // window to receive hot-key notification
int id, // identifier of hot key
UINT fsModifiers, // key-modifier flags
UINT vk // virtual-key code
);
Parameters
hWnd
Identifies the window that will receive WM_HOTKEY messages generated by
the hot key. If this parameter is NULL, WM_HOTKEY messages are posted to
the message queue of the calling thread and must be processed in the
message loop.
id
Specifies the identifier of the hot key. No other hot key in the calling
thread should have the same identifier. An application must specify a
value in the range 0x0000 through 0xBFFF. A shared dynamic-link library
(DLL) must specify a value in the range 0xC000 through 0xFFFF (the range
returned by the GlobalAddAtom function). To avoid conflicts with hot-key
identifiers defined by other shared DLLs, a DLL should use the
GlobalAddAtom function to obtain the hot-key identifier.
fsModifiers
Specifies keys that must be pressed in combination with the key
specified by the nVirtKey parameter in order to generate the WM_HOTKEY
message. The fsModifiers parameter can be a combination of the following
values:
Value Meaning
MOD_ALT Either ALT key must be held down.
MOD_CONTROL Either CTRL key must be held down.
MOD_SHIFT Either SHIFT key must be held down.
vk
Specifies the virtual-key code of the hot key.
Return Values
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero.
Remarks
When a key is pressed, the system looks for a match against all thread
hot keys. Upon finding a match, the system posts the WM_HOTKEY message
to the message queue of the thread that registered the hot key. This
message is posted to the beginning of the queue so it is removed by the
next iteration of the message loop.
This function cannot associate a hot key with a window created by
another thread.
RegisterHotKey fails if the keystrokes specified for the hot key have
already been registered by another hot key.
If the window identified by the hWnd parameter already registered a hot
key with the same identifier as that specified by the id parameter, the
new values for the fsModifiers and vk parameters replace the previously
specified values for these parameters.
et
//WM_HOTKEY
The WM_HOTKEY message is posted when the user presses a hot key
registered by the RegisterHotKey function. The message is placed at the
top of the message queue associated with the thread that registered the
hot key.
WM_HOTKEY
idHotKey = (int) wParam; // identifier of hot key
fuModifiers = (UINT) LOWORD(lParam); // key-modifier flags
uVirtKey = (UINT) HIWORD(lParam); // virtual-key code
Parameters
idHotKey
Value of wParam. Specifies the identifier of the hot key that generated
the message. If the message was generated by a system-defined hot key,
the idHotKey parameter will be one of the following values:
Value Meaning
IDHOT_SNAPDESKTOP The "snap desktop" hot key was pressed.
IDHOT_SNAPWINDOW The "snap window" hot key was pressed.
fuModifiers
Specifies the keys that were to be pressed in combination with the key
specified by the nVirtKey parameter to generate the WM_HOTKEY message.
The fuModifiers parameter can be a combination of the following values:
Value Meaning
MOD_ALT Either ALT key was held down.
MOD_CONTROL Either CTRL key was held down.
MOD_SHIFT Either SHIFT key was held down.
MOD_WIN Either WINDOWS key was held down. These keys appear only on the
Microsoft Ergonomic Keyboard and are labeled with the Microsoft Windows
logo.
uVirtKey
Specifies the virtual key code of the hot key.
Remarks
WM_HOTKEY is unrelated to the WM_GETHOTKEY and WM_SETHOTKEY hot keys.
The WM_HOTKEY message is sent for generic hot keys while the
WM_SET\GETHOTKEY messages relate to window activation hot keys.
En windev voici un exemple de récupération :
Procedure CtrlHotKey()
cChamp est une chaine = ChampEnCours()
cReprise est une chaine
//---
Selon _EVE.wParam //VK_KEY
fin
PYT
Cordalement
PYT
i est un entier
EvtHotKey est un entier long
WM_HOTKEY est un entier = 786
MOD_ALT est un entier = 1
MOD_CTL est un entier = 2
MOD_SFT est un entier = 4
pour i=asc("A") a asc("Z")
AppelDll32("USER32","RegisterHotKey",handle("HOTKEY"),100+i,MOD_CTL+MOD_ALT,i)
fin
EvtHotKey = Evenement("CtrlHotKey","HOTKEY",WM_HOTKEY)
Fermeture de fenêtre HOTKEY
i est un entier
pour i=asc("A") a asc("Z")
AppelDll32("USER32","UnregisterHotKey",Handle("HOTKEY"),100+1)
fin
Prise de focus de fenêtre HOTKEY
Perte de focus de fenêtre HOTKEY
Modification de la taille de fenêtre HOTKEY
Procédure CtrlHotKey
procedure CtrlHotKey()
trace( _eve.wparam-100) // on récupére la touche enfoncé
The fsModifiers parameter can be a combination of the following
values:
c'était la petite info qui me manquait !!!!!!!
Par contre, c'est vrai qu'on se casse un peu la tête pour rien !!!!!! Mais à
force d'être obligé de contourner les insuffisances de Windev, on prend de
mauvaises habitudes !!!
Voici le code qui fonctionne pile poil en WD5 et WD7 fourni par Lilian PUECH
// code d'ouverture de la fenêtre
global
numeve est un entier long
numeve=evenement("Touche","*.*",256)
// code de fermeture de la fenêtre
finevenement(numeve)
// procedure interne TOUCHE
Procédure Touche()
// wParam des touches lettres compris entre 65 (a) et 90 (z)
si _EVE.wParam>64 et _EVE.wParam<91 alors
si toucheenfonce(teControl,vrai) et toucheenfonce(teAlt,vrai) alors
info("+ctrl +alt +lettre")
fin
fin
--
Cordialement
"Pierre-yves Tavernier" <pierre-yve...@fr.adp.com> a écrit dans le
message de news:
dff0cb888e8558563d3...@mygate.mailgate.org...