j'espérer que la correction de Nico pourra satisfaire Ar-S.
Je propose une autre solution qui consiste à connaitre l'application qui est au premier plan et est ce que cette application recouvre totalement la radio. Cette solution utilise des API Windows
Code : Tout sélectionner
Enumeration
#Mainform
#ForeGroundApplication
EndEnumeration
Define.l Event, GEvent, TiEvent
Structure Process
ExeName.s
Left.i
Top.i
Width.i
Height.i
EndStructure
Global NewList Applications.Process()
Procedure.s ListWindows(hwnd,Param)
Protected Buffer.s
If GetWindowLong_(hwnd, #GWL_EXSTYLE) ! #WS_EX_TOOLWINDOW And GetWindowLong_(hwnd, #GWL_STYLE) & #WS_VISIBLE
Buffer = Space(250)
GetWindowText_(hwnd, Buffer, 250)
GetWindowRect_(hWnd, rc.RECT)
If Buffer<>"" And Buffer <> "Démarrer"
AddElement(Applications())
Applications()\ExeName = Buffer
Applications()\Left = rc\left
Applications()\Top = rc\top
Applications()\Width = rc\right - rc\left
Applications()\Height = rc\bottom - rc\top
EndIf
EndIf
EndProcedure
Procedure Open_MainForm()
OpenWindow(#Mainform, 0, 0, 465, 80, "Ar-S Radio", #PB_Window_SystemMenu)
TextGadget(#ForeGroundApplication, 10, 10, 400, 20, "")
AddWindowTimer(#Mainform, 100, 500)
EndProcedure
Open_MainForm()
Repeat
Event = WaitWindowEvent(10)
GEvent = EventGadget()
TiEvent = EventTimer()
Select Event
Case #PB_Event_Timer
Select TiEvent
Case 100
ClearList(Applications())
EnumChildWindows_(FindWindow_("ToolbarWindow32",0),@ListWindows(),0)
FirstElement(Applications())
With Applications()
SetGadgetText(#ForeGroundApplication, Str(n)+" - "+\ExeName + " Left: "+\Left + " Top: "+\Top + " Width: "+\Width + " Height: "+\Height)
If \ExeName <> "Ar-S Radio"
If WindowX(#Mainform)>=\Left And WindowX(#Mainform)<=\Left+\Width
If WindowY(#Mainform)>=\Top And WindowY(#Mainform)<=\Top+\Height
MessageRequester("Information","J'ai été recouvert par "+\ExeName)
EndIf
EndIf
EndIf
EndWith
EndSelect
Case #PB_Event_CloseWindow
End
EndSelect
ForEver
Lancer ce code et cliquer ensuite sur une autre application. Vous verrez que le nom de l'application active s'affiche avec ses coordonnées. Essayez ensuite de recouvrir la fenêtre de test avec l'application active. Une boite d'information vous informera que la fenêtre de test a été recouverte.