Voici un début pour créer une fenêtre comme celle que j'avais demandé là.
► Afficher le texteWPF Transparent Window
Code : Tout sélectionner
#include <StructureConstants.au3>
#include <GUIConstants.au3>
#include <ColorConstants.au3>
#include <WinAPIGdi.au3>
$GUI = GUICreate("", 611, 422, Default, Default, BitXOR($GUI_SS_DEFAULT_GUI, $WS_MINIMIZEBOX))
ApplyGlass($GUI,0,0,35,0,0x000000)
GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST")
$Apply = GUICtrlCreateButton("Apply", 80, 104, 83, 25, 0)
Global $Icon1 = GUICtrlCreateIcon("C:\Windows\System32\wmploc.dll", -2, 12, 2, 24, 24)
Global $hIcon = _WinAPI_GetClassLongEx($GUI, -14)
ConsoleWrite(VarGetType($hIcon))
GUISetIcon(@AutoItExe, -2, $GUI)
Global $Graphic1 = GUICtrlCreateGraphic(-1, 35, 615, 388)
GUICtrlSetColor($Graphic1, 0xffffff)
GUICtrlSetBkColor($Graphic1, 0xffffff)
Global $Graphic2 = GUICtrlCreateGraphic(-1, 380, 615, 43)
GUICtrlSetColor($Graphic2, 0xf0f0f0)
GUICtrlSetBkColor($Graphic2, 0xf0f0f0)
;GUICtrlSetBkColor($Apply, $COLOR_WHITE)
GUISetState(@SW_SHOW)
While 1
$iMsg = GUIGetMsg()
Switch $iMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func ApplyGlass($hWnd,$leftw,$rightw,$toph,$bottomh,$glasscolor = "0x000000")
$struct=DllStructCreate("int cxLeftWidth;int cxRightWidth;int cyTopHeight;int cyBottomHeight;")
DllStructSetData($struct,"cxLeftWidth",$leftw)
DllStructSetData($struct,"cxRightWidth",$rightw)
DllStructSetData($struct,"cyTopHeight",$toph)
DllStructSetData($struct,"cyBottomHeight",$bottomh)
GUISetBkColor($glasscolor)
Return DllCall("dwmapi.dll", "int", "DwmExtendFrameIntoClientArea", "hwnd", $hWnd, "ptr", DllStructGetPtr($struct))
EndFunc
; #FUNCTION# ====================================================================================================================
; Name...........: _WinAPI_GetClassLongEx
; Description....: Retrieves the specified value associated with the specified window.
; Syntax.........: _WinAPI_GetClassLongEx ( $hWnd, $iIndex )
; Parameters.....: $hWnd - Handle to the window.
; $iIndex - The value to retrieve. This parameter can be one of the following values.
;
; $GCL_CBCLSEXTRA
; $GCL_CBWNDEXTRA
; $GCL_HBRBACKGROUND
; $GCL_HCURSOR
; $GCL_HICON
; $GCL_HICONSM
; $GCL_HMODULE
; $GCL_MENUNAME
; $GCL_STYLE
; $GCL_WNDPROC
;
; Return values..: Success - The requested value.
; Failure - 0 and sets the @error flag to non-zero.
; Author.........: Yashied
; Modified.......:
; Remarks........: None
; Related........:
; Link...........: @@MsdnLink@@ GetClassLong
; Example........: Yes
; ===============================================================================================================================
Func _WinAPI_GetClassLongEx($hWnd, $iIndex)
Local $Ret
If @AutoItX64 Then
$Ret = DllCall('user32.dll', 'ulong_ptr', 'GetClassLongPtrW', 'hwnd', $hWnd, 'int', $iIndex)
Else
$Ret = DllCall('user32.dll', 'ulong', 'GetClassLongW', 'hwnd', $hWnd, 'int', $iIndex)
EndIf
If (@error) Or (Not $Ret[0]) Then
Return SetError(1, 0, 0)
EndIf
Return $Ret[0]
EndFunc ;==>_WinAPI_GetClassLongEx
; #FUNCTION# ====================================================================================================================
; Name...........: _WinAPI_SetClassLongEx
; Description....: Replaces the specified value into the specified window belongs.
; Syntax.........: _WinAPI_SetClassLongEx ( $hWnd, $iIndex, $iNewLong )
; Parameters.....: $hWnd - Handle to the window.
; $iIndex - The value to be replaced. This parameter can be one of the following values.
;
; $GCL_CBCLSEXTRA
; $GCL_CBWNDEXTRA
; $GCL_HBRBACKGROUND
; $GCL_HCURSOR
; $GCL_HICON
; $GCL_HICONSM
; $GCL_HMODULE
; $GCL_MENUNAME
; $GCL_STYLE
; $GCL_WNDPROC
;
; $iNewLong - The replacement value.
; Return values..: Success - The previous value.
; Failure - 0 and sets the @error flag to non-zero.
; Author.........: Yashied
; Modified.......:
; Remarks........: None
; Related........:
; Link...........: @@MsdnLink@@ SetClassLong
; Example........: Yes
; ===============================================================================================================================
Func _WinAPI_SetClassLongEx($hWnd, $iIndex, $iNewLong)
Local $Ret
If @AutoItX64 Then
$Ret = DllCall('user32.dll', 'ulong_ptr', 'SetClassLongPtrW', 'hwnd', $hWnd, 'int', $iIndex, 'long_ptr', $iNewLong)
Else
$Ret = DllCall('user32.dll', 'ulong', 'SetClassLongW', 'hwnd', $hWnd, 'int', $iIndex, 'long', $iNewLong)
EndIf
If (@error) Or (Not $Ret[0]) Then
Return SetError(1, 0, 0)
EndIf
Return $Ret[0]
EndFunc ;==>_WinAPI_SetClassLongEx
Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam)
$mgpos=MouseGetPos()
$winPos=WinGetPos("TT")
;_ArrayDisplay($winPos)
;If _WinAPI_PtInRectEx($mgpos[0], $mgpos[1], $winPos[0], $winPos[1], $winPos[0]+$winPos[2], $winPos[1]+$winPos[3]) Then ConsoleWrite('cock')
If $hWnd = $GUI And $iMsg = $WM_NCHITTEST And _WinAPI_PtInRectEx($mgpos[0], $mgpos[1], $winPos[0], $winPos[1], $winPos[0]+$winPos[2], $winPos[1]+$winPos[3])=True Then Return 2
EndFunc