//Dans la partie Déclarations globales de la fenêtre principale écrire
gnPrevproc est entier
//Dans la partie Initialisation de la fenêtre principale écrire
// On subclasse la fenêtre principale pour pouvoir prendre la main sur WinDev.
gnPrevproc = SetWindowLong(gnhMain, GWL_WNDPROC, &WndProc)
//Dans la partie Fermeture de la fenêtre principale écrire
SI gnPrevproc ALORS
SetWindowLong(gnhMain, GWL_WNDPROC, gnPrevproc)
gnPrevproc = 0
FIN
//Dans la partie Procédures locales de la fenêtre principale créer la fonction callback
FONCTION WndProc(nhWnd est entier, nMsg est entier, nwParam est entier, nlParam est entier)
nRet est entier
SELON nMsg
CAS WM_MENUCOMMAND
// Ecrire votre code ici
CAS etc.
FIN
SI gnPrevproc ALORS
nRet = CallWindowProc(gnPrevproc, nhWnd, nMsg, nwParam, nlParam)
FIN
RENVOYER nRet
//-------------------------------------------
// Encapsulation de l'API "SetWindowLong"
FONCTION SetWindowLong(nHandle est entier, nIndex est entier, nNewValue est entier)
nRet est entier = API("USER32", "SetWindowLongA", nHandle, nIndex, nNewValue)
RENVOYER nRet
//-------------------------------------------
// Encapsulation de l'API "CallWindowProc"
FONCTION CallWindowProc(nPrevProc est entier, nHandle est entier, nMsg est entier, nwParam est entier, nlParam est entier)
nRet est entier = API("USER32", "CallWindowProcA", nPrevProc, nHandle, nMsg, nwParam, nlParam)
RENVOYER nRet
Cette contribution était de : http://old.wdforge.org/newbb/viewtopic.php?forum=17&topic_id=4252&post_id=17775