Bouton dans la barre de titre
Publié : dim. 29/janv./2006 21:31
J'ai fait un code pour mettre un bouton dans la barre de titre, mais impossible de récupérer le résultat lorsqu'il est cliqué, si vous avez une idée
Je vous remercie d'avance

Je vous remercie d'avance

ProcedureDLL MSG(Text.s) ; Affiche une boîte de dialogue
MessageRequester ( "Information" , text.s)
EndProcedure
Global WHook
Global FrmH.l
Global CtrlH.l
Declare HookProc(nCode, wParam, lParam)
Procedure Init(FormHwnd.l, ControlHwnd.l)
FrmH = FormHwnd
CtrlH = ControlHwnd
hInstance = GetModuleHandle_ (0)
lpdwProcessId = GetWindowThreadProcessId_ (FormHwnd, 0)
WHook = SetWindowsHookEx_ ( #WH_CALLWNDPROC , @HookProc(), hInstance, lpdwProcessId)
SetWindowLong_ (ControlHwnd, #GWL_EXSTYLE , $80)
SetParent_ (ControlHwnd, GetParent_ (FormHwnd))
GetWindowRect_ (FrmH, w.rect)
SetWindowPos_ (CtrlH, 0, w\right-100, W\Top+4, 23, 23, #SWP_FRAMECHANGED )
EndProcedure
Procedure Terminate(FormHwnd.l, ControlHwnd.l)
UnhookWindowsHookEx_ (WHook)
SetParent_ (ControlHwnd, FormHwnd)
EndProcedure
Procedure HookProc(nCode, wParam, lParam)
*Msg.CWPSTRUCT = lparam
If *Msg\hwnd = FrmH
If *Msg\Message = #WM_NCPAINT Or *Msg\Message = #WM_MOVE
GetWindowRect_ (FrmH, win.rect)
SetWindowPos_ (CtrlH, 0, win\right-100, Win\Top+4, 23, 23, #SWP_FRAMECHANGED )
Else
Debug *Msg\Message
EndIf
EndIf
EndProcedure
win= OpenWindow ( #PB_Any ,0,0,200,200, #PBWIN0 , "test" )
If win And CreateGadgetList ( WindowID (win))
ButtonGadget (0,0,0,10,10, " _" ) : GadgetToolTip (0, "Place la fenêtre dans la barre système" )
ButtonGadget (1,10,10,30,30, " _" )
Init( WindowID (win), GadgetID (0))
Repeat
Select WaitWindowEvent ()
Case #PB_EventGadget
Select EventGadgetID ()
Case 0
Debug "test"
Case 1
MSG( "test" )
Default
Debug 1
EndSelect
Case #PB_Event_CloseWindow
quit=1
EndSelect
Until quit=1
EndIf
Terminate( WindowID (), GadgetID (0))