Code : Tout sélectionner
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StructureConstants.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
Dim $hCurr_HhWnd = 0
$MainGUI = GUICreate("Skinner Tool ", 500, 603, -1, -1)
$WindowInfo = GUICtrlCreateButton("Tools", 430, 30, 60, 30, $BS_ICON, BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))
GUISetState()
;Window Info Gui
$WindowInfoGUI = GUICreate("Window Info", 496, 170, -3, -205,BitOR($WS_SYSMENU,$WS_DLGFRAME,$WS_POPUP,$WS_CLIPSIBLINGS),bitor($WS_EX_MDICHILD,$WS_EX_CLIENTEDGE),$MainGUI)
$windowtitle = GUICtrlCreateLabel("Title : ",10, 10, 490, 20)
;GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$windowclass = GUICtrlCreateLabel("Class : ",10, 40, 490, 100)
;GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUISetState(@SW_HIDE,$WindowInfoGUI)
$WindowInfoGUIStatus = False
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
If WinActive($MainGUI) Then
Exit
ElseIf WinActive($WindowInfoGUI) Then
GUISetState(@SW_HIDE,$WindowInfoGUI)
EndIf
;Info fenêtre
Case $WindowInfo
GUISwitch($WindowInfoGUI)
if $WindowInfoGUIStatus = true Then
GUISetState(@SW_HIDE,$WindowInfoGUI)
$WindowInfoGUIStatus = False
Else
GUISetState(@SW_SHOW,$WindowInfoGUI)
$WindowInfoGUIStatus = True
EndIf
EndSwitch
;donne la classe et le nom d'une fenêtre cliquée
If $WindowInfoGUIStatus = True Then
Opt("MouseCoordMode", 1) ;1=absolute, 0=relative, 2=client
If @AutoItX64 Then
Local $tPoint = DllStructCreate("int X;int Y")
DllStructSetData ( $tPoint, "X", MouseGetPos(0))
DllStructSetData ( $tPoint, "Y", MouseGetPos(1))
Local $tPoint64 = DllStructCreate("int64", DllStructGetPtr($tPoint))
Local $aHwnd = DllCall("user32.dll", "hwnd", "WindowFromPoint", "int64", DllStructGetData($tPoint64, 1))
Else
Local $aHwnd = DllCall("user32.dll", "hwnd", "WindowFromPoint", "uint", MouseGetPos(0), "uint", MouseGetPos(1))
EndIf
If $aHwnd[0] <> $hCurr_HhWnd Then
GUICtrlSetData($windowclass,"Class : "&_WinAPI_GetClassName($aHwnd[0]) & @CRLF)
Local $stPoint=DllStructCreate($tagPOINT),$hControl,$hWin,$aLastPos[2]=[-1,-1],$sLastStr='',$sStr
DllStructSetData($stPoint,1,MouseGetPos(0))
DllStructSetData($stPoint,2,MouseGetPos(1))
$hControl=_WinAPI_WindowFromPoint($stPoint)
$hWin=_WinAPI_GetAncestor($hControl,2)
GUICtrlSetData($windowtitle,"Title : "&WinGetTitle($hWin))
$hCurr_HhWnd = $aHwnd[0]
EndIf
EndIf
Wend