Page 1 sur 2

fenetre qui ne se voit pas en bas !

Publié : mar. 13/juin/2006 20:36
par graph100
je ne sais pas si je me suis fait comprendre ... je voudrait créé une fenetre qui ne possede pas ca:
Image
voila ^^

j'étais tombé dessus en faisait une fausse manip a l'editeur graphique mais je n'arrive plus a le refaire . lol :roll:

Publié : mar. 13/juin/2006 21:01
par AWEAR
Tu peux faire ça comme ça, mais c'est plus un truc fait à l'arrache que quelque chose de conventionnel :

Code : Tout sélectionner

OpenWindow(0, 0, 0, 500, 500, "test", #PB_Window_Invisible)
OpenWindow(1, 0, 0, 500, 500, "test", 0, WindowID(0))
Repeat
Until WaitWindowEvent() = 16

Publié : mar. 13/juin/2006 21:07
par Gillou
ProcedureDLL HideFromTaskbar(Window, State) ; Cache la fenêtre de la barre des tâches
    Shared proc_HideFromTaskbar_Object
     If STATE = 0
        CallCOM( #HideFromTaskbar_AddTab , proc_HideFromTaskbar_Object, WindowID (WINDOW)) ; Montrer la fenêtre
     Else
        CallCOM( #HideFromTaskbar_DeleteTab , proc_HideFromTaskbar_Object, WindowID (WINDOW)) ; Cacher la fenêtre
     EndIf
EndProcedure

ProcedureDLL InitHideFromTaskbar() ; Initialise le mode cacher de la barre des tâches
    Shared proc_HideFromTaskbar_Object
     CoInitialize_ (0)
     CoCreateInstance_ (?CLSID_TaskbarList, 0, 1, ?IID_ITaskbarList, @proc_HideFromTaskbar_Object)
    CallCOM( #HideFromTaskbar_HrInit , proc_HideFromTaskbar_Object) ; Initialiser l'objet
     DataSection
        CLSID_TaskbarList :
             Data.l $56FDF344
             Data.w $FD6D, $11D0
             Data.b $95, $8A, $00, $60, $97, $C9, $A0, $90
        IID_ITaskbarList :
             Data.l $56FDF342
             Data.w $FD6D, $11D0
             Data.b $95, $8A, $00, $60, $97, $C9, $A0, $90
     EndDataSection
EndProcedure

ProcedureDLL EndHideFromTaskbar() ; Coupe le mode cacher de la barre des tâches
    Shared proc_HideFromTaskbar_Object
    CallCOM( #HideFromTaskbar_Release , proc_HideFromTaskbar_Object)
     CoUninitialize_ ()
EndProcedure

InitHideFromTaskbar()
win = OpenWindow ( #PB_Any , 0, 0, 200, 200, "test" , #PBWIN0 )
If win And CreateGadgetList ( WindowID (win))
Repeat
    HideFromTaskbar(win, 1)
     Select WaitWindowEvent ()
     EndSelect
Until Quit = 1
EndHideFromTaskbar()
EndIf

Publié : mar. 13/juin/2006 21:20
par Flype
une autre méthode plus simple :

Code : Tout sélectionner

Procedure RemoveFromTaskbar(hwnd) 
  If IsWindow_(hwnd) 
    a=hwnd : b=GetWindowLong_(a,#GWL_HWNDPARENT) : If b<>0 : a=b : EndIf ; Needed for "TaskAssign.exe". 
    ShowWindow_(a,#SW_HIDE) : GetWindowRect_(a,win.RECT) : w=win\right-win\left : h=win\bottom-win\top 
    SetWindowLong_(a,#GWL_EXSTYLE,#WS_EX_TOOLWINDOW) :  SetWindowPos_(a,0,0,0,w-1,h-1,#SWP_NOMOVE) 
    SetWindowPos_(a,0,0,0,w,h,#SWP_NOMOVE|#SWP_SHOWWINDOW) : ProcedureReturn 1 
  EndIf 
EndProcedure 

Debug RemoveFromTaskbar(FindWindow_(0,"titre de la fenetre")) 


Publié : mer. 14/juin/2006 17:13
par bernard13
peux m'expliquer en details ton code Flype svp

Publié : mer. 14/juin/2006 18:22
par Flype
si tu veux.
cette fonction est de PB (un des grands contributeur du forum officiel)

je l'ai réécrite pour nous
plus dans l'esprit purebasic, un peu comme StickyWindow :

Code : Tout sélectionner

Procedure ToolWindow(window.l, state.l = #True) 
  
  Protected hwnd.l = WindowID(window)
  
  ; cache la fenêtre
  
  ShowWindow_(hwnd, #SW_HIDE)
  
  ; change le style de la fenêtre ( le plus important ) 
  
  If state 
    SetWindowLong_(hwnd, #GWL_EXSTYLE, GetWindowLong_(hwnd, #GWL_EXSTYLE) | #WS_EX_TOOLWINDOW) 
  Else 
    SetWindowLong_(hwnd, #GWL_EXSTYLE, GetWindowLong_(hwnd, #GWL_EXSTYLE) & (~#WS_EX_TOOLWINDOW)) 
  EndIf 
  
  ; notifie la fenêtre que son apparence a changé (mais ni sa taille, ni sa position) 
  
  If SetWindowPos_(hwnd, 0, 0, 0, 0, 0, #SWP_NOSIZE|#SWP_NOMOVE|#SWP_SHOWWINDOW| #SWP_FRAMECHANGED)
    ProcedureReturn #True 
  EndIf 
  
EndProcedure 

Procedure IsToolWindow(window) 
  
  ; la fenêtre at-t-elle le style 'toolwindow' ? 
  
  If GetWindowLong_(WindowID(window), #GWL_EXSTYLE) & #WS_EX_TOOLWINDOW
    ProcedureReturn #True 
  EndIf 
  
EndProcedure 

;- 

If OpenWindow(0, 0, 0, 640, 480, "toolwindow", #PB_Window_SystemMenu|#PB_Window_ScreenCentered) 
  
  If CreateGadgetList(WindowID(0))
    ButtonGadget(0, 5, 5, 150, 30, "ToolWindow On/Off", #PB_Button_Toggle)
  EndIf
  
  Repeat 
    Select WaitWindowEvent()
      Case #PB_Event_CloseWindow 
        Break
      Case #PB_Event_Gadget
        ToolWindow(0, #True-IsToolWindow(0)) 
    EndSelect
  ForEver
  
EndIf

Publié : mer. 14/juin/2006 20:26
par bernard13
merci Flype

je suis entrain de crée mon propre requester ...

Publié : mer. 14/juin/2006 21:24
par graph100
@Flype
je ne comprend pas : ton code change l'apparence de la fenetre et ne cache pas la fenetre de la barre des taches !!

@Gillou
ca marche tres bien ! merci

j'ai vu que en créant la fenetre avec une fenetre parent elle était pas dans la barre des taches

je n'ai pas tres bien compris a quoi servait la procedure ActivateWindow()
exist- il une procedure permettant de changer la current window ? avec le handle de la fenetre a mettre en current ?

Publié : mer. 14/juin/2006 21:45
par Backup
@Gillou : si ton code utilise un librairie , il faudrai le specifier ! :D

c'est quoi ce CallCOM ?? 8O

Publié : mer. 14/juin/2006 22:18
par Flype
graph100 a écrit :@Flype
je ne comprend pas : ton code change l'apparence de la fenetre et ne cache pas la fenetre de la barre des taches !!
ouhla oui, tu as raison.
j'ai mis à jour le code plus haut. ca marche bien maintenant.
:o

Publié : jeu. 15/juin/2006 10:47
par graph100
sinon quand on efface la barre de tache ca change le style de la fenetre en toolwindow :(

Publié : jeu. 15/juin/2006 11:14
par Flype
que veux tu dire par "quand on efface la barre de tache" ???

Publié : jeu. 15/juin/2006 11:19
par nico
Oui, c'est normal, ce sont des fenêtres qui servent pour créer des barre d'outils.

Publié : jeu. 15/juin/2006 12:45
par graph100
oups .. j'ai ouublié des mots

"la fenetre de la barre des taches"

@nico
ca doit etre possible : en faisant avec les fenetres parents les fenetres ne sont pas affichée dans la barre de tache...mais j'ai l'impression que les evenements des fenetres parentes sont detecter sur les fenetres "enfant"

Publié : jeu. 15/juin/2006 13:18
par Flype
en général, quand je veux pas qu'une fenetre apparaisse en bas,
d'abord j'utilise le style 'toolwindow', c'est facile et c'est plus propre.

une autre solution qui vaut ce qu'elle vaut :
tu peux créer un 'systrayicon' (voir AddSystrayIcon) qui permettra à l'utilisateur de facilement montrer/cacher la fenetre d'un simple click sur l'icone 'systray'.

peut etre encore une autre idée.
si la bordure de titre au style 'toolwindow' ne te plait pas,
à la limite tu peut carrément cacher toute la barre :

Code : Tout sélectionner

Procedure.l IsToolWindow(window)
  If GetWindowLong_(WindowID(window), #GWL_EXSTYLE) & #WS_EX_TOOLWINDOW
    ProcedureReturn #True
  EndIf
EndProcedure
Procedure.l ToolWindow(window.l, state.l = #True)
  Protected hwnd.l = WindowID(window)
  ShowWindow_(hwnd, #SW_HIDE)
  If state
    SetWindowLong_(hwnd, #GWL_STYLE, GetWindowLong_(hwnd, #GWL_STYLE) & (~#WS_BORDER))
    SetWindowLong_(hwnd, #GWL_EXSTYLE, GetWindowLong_(hwnd, #GWL_EXSTYLE) | #WS_EX_TOOLWINDOW)
  Else
    SetWindowLong_(hwnd, #GWL_STYLE, GetWindowLong_(hwnd, #GWL_STYLE) | #WS_BORDER)
    SetWindowLong_(hwnd, #GWL_EXSTYLE, GetWindowLong_(hwnd, #GWL_EXSTYLE) & (~#WS_EX_TOOLWINDOW))
  EndIf
  If SetWindowPos_(hwnd, 0, 0, 0, 0, 0, #SWP_NOSIZE|#SWP_NOMOVE|#SWP_SHOWWINDOW| #SWP_FRAMECHANGED)
    ProcedureReturn #True
  EndIf
EndProcedure

;-

If OpenWindow(0, 0, 0, 320, 240, "toolwindow", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
  
  If CreateGadgetList(WindowID(0))
    ButtonGadget(0, 5, 5, 150, 30, "ToolWindow On/Off", #PB_Button_Toggle)
  EndIf
  
  Repeat
    Select WaitWindowEvent()
      Case #PB_Event_CloseWindow
        Break
      Case #PB_Event_Gadget
        ToolWindow(0, #True - IsToolWindow(0))
      Case #WM_LBUTTONDOWN
        If ChildWindowFromPoint_(WindowID(0), WindowMouseX(0), WindowMouseY(0)) = WindowID(0)
          ReleaseCapture_()
          SendMessage_(WindowID(0), #WM_NCLBUTTONDOWN, #HTCAPTION, #Null)
        EndIf
    EndSelect
  ForEver
  
EndIf