changer les options #PB_Window_... à l'execution

Vous débutez et vous avez besoin d'aide ? N'hésitez pas à poser vos questions
Patrick88
Messages : 1564
Inscription : mer. 21/janv./2004 18:24

changer les options #PB_Window_... à l'execution

Message par Patrick88 »

je crée une fenetre par openwindow avec le parametre #PB_Window_SystemMenu

si je veux par la suite lui rajouter le parametre #PB_Window_SizeGadget

comment fais-je ?

avec des sendmessage, je suppose ?

pat
Dr. Dri
Messages : 2527
Inscription : ven. 23/janv./2004 18:10

Message par Dr. Dri »

setwindowlong_ avec #gwl_style
(pas sûr pour la constante, mais cherche sur le forum)

Dri
Avatar de l’utilisateur
Flype
Messages : 2431
Inscription : jeu. 29/janv./2004 0:26
Localisation : Nantes

Message par Flype »

Yep, ya pas d'autres solutions que de passer par l'api win32 sauf pour StickyWindow() dans PB4

Un tout petit example :

Code : Tout sélectionner

If OpenWindow(1,0,0,320,240,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"style") 
  
  hWnd1 = WindowID(1)
  
  If CreateGadgetList(hWnd1)
    ButtonGadget(1,50,50,100,22,"style",#PB_Button_Toggle)
  EndIf
  
  Repeat 
    Select WaitWindowEvent() 
      Case #PB_Event_CloseWindow
        Break
      Case #PB_Event_Gadget 
        Select EventGadget() 
          Case 1
            Select GetGadgetState(1)
              Case 0
                
                Style = GetWindowLong_(hWnd1,#GWL_STYLE) | #WS_DLGFRAME
                ExStyle = GetWindowLong_(hWnd1,#GWL_EXSTYLE) | #WS_EX_WINDOWEDGE
                
                SetWindowLong_(hWnd1,#GWL_STYLE,Style)
                SetWindowLong_(hWnd1,#GWL_EXSTYLE,ExStyle)
                SetWindowPos_(hWnd1,#HWND_TOPMOST,0,0,0,0,#SWP_FRAMECHANGED|#SWP_NOMOVE|#SWP_NOSIZE)
                
              Case 1
                
                Style = GetWindowLong_(hWnd1,#GWL_STYLE) - #WS_DLGFRAME
                ExStyle = GetWindowLong_(hWnd1,#GWL_EXSTYLE) - #WS_EX_WINDOWEDGE
                
                SetWindowLong_(hWnd1,#GWL_STYLE,Style)
                SetWindowLong_(hWnd1,#GWL_EXSTYLE,ExStyle)
                SetWindowPos_(hWnd1,#HWND_TOPMOST,0,0,0,0,#SWP_FRAMECHANGED|#SWP_NOMOVE|#SWP_NOSIZE)
                
            EndSelect
        EndSelect
    EndSelect 
  ForEver
  
EndIf
Image
Patrick88
Messages : 1564
Inscription : mer. 21/janv./2004 18:24

Message par Patrick88 »

okay, merci...

je vais pouvoir continuer mon bidule... bien que cela n'ai pas été (trop) bloquant...

merci encore

patrick
Répondre