Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

TopMost : SetWindowPos vs SetWindowLong

2 réponses
Avatar
tsalm
Bonjour,

Je rencontre un problème bizarre.
Je dois mettre une fenêtre en TopMost.

Si je fais ça, ca fonctionne très bien :
// --------------------------------
SetWindowPos( hwd_win32 ,
HWND_TOPMOST ,
0,0,0,0 ,
SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE
) )
// --------------------------------


Par contre, si je fais ça, ca ne fonctionne pas :
// --------------------------------
LONG oldStyle = GetWindowLong( hwd_win32 , GWL_EXSTYLE );
SetWindowLong(
hwd_win32 ,
GWL_EXSTYLE ,
oldStyle | WS_EX_TOPMOST //& (!WS_EX_APPWINDOW)
)
// --------------------------------

Comprends pas pourquoi !?

Je vous remercie par avance pour vos réponses ô combien toujours
éclairantes !

TSalm

2 réponses

Avatar
domi
tsalm wrote:

Par contre, si je fais ça, ca ne fonctionne pas :
// --------------------------------
LONG oldStyle = GetWindowLong( hwd_win32 , GWL_EXSTYLE );
SetWindowLong(
hwd_win32 ,
GWL_EXSTYLE ,
oldStyle | WS_EX_TOPMOST //& (!WS_EX_APPWINDOW)
)
// --------------------------------

Comprends pas pourquoi !?



C'est normal, çà n'a pas été prévu pour ça.
C'est dans la doc MSDN :

WS_EX_TOPMOST
To add or remove this style, use the SetWindowPos function.
Avatar
tsalm
On 23 août, 21:54, domi wrote:
tsalm wrote:
> Par contre, si je fais ça, ca ne fonctionne pas :
> // --------------------------------
>   LONG oldStyle = GetWindowLong( hwd_win32 , GWL_EXSTYLE );
>   SetWindowLong(  
>     hwd_win32 ,
>     GWL_EXSTYLE ,
>     oldStyle | WS_EX_TOPMOST  //& (!WS_EX_APPWINDOW)
>   )
> // --------------------------------

> Comprends pas pourquoi !?

C'est normal, çà n'a pas été prévu pour ça.
C'est dans la doc MSDN :

WS_EX_TOPMOST
    To add or remove this style, use the SetWindowPos function.



Ok merci