Hey ich hab mich vor längerem mal an sowas ähnlichem wie den Aero effekt von Win Vista und Win 7 probiert.
Ist nichts besonderes ich weiß aber vllt gefällts ja jemand
Spoiler anzeigen
#include <WinAPI.au3>
#include <GDIPlus.au3>
#include <Array.au3>
#Include <Misc.au3>
#include <MyHover.au3>
Enum $GUIMain, $hGUIMain, $GUITitle, $GUIWidth, $GUIHeight, _
$ScreenDc, $dc, $tSize, $pSize, $tSource, $pSource, $tBlend, $pBlend, $tPoint, $pPoint , $GUIAnz
Enum $hGDIGraphic, $hGDIBitmap, $hGDIBuffer, $hGDIBitmapCornerUPLeft, $hGDIBitmapCornerUPRight, $hGDIBitmapCornerDownLeft, $hGDIBitmapCornerDownRight, _
$hGDIBitmapBorderUP, $hGDIBitmapBorderLeftRight, $hGDIBitmapBorderDown, $hBrushRectClient, $hGDIBitmapSysMenueMini, $hGDIBitmapSysMenueMaxiDea, _
$hGDIBitmapSysMenueClose, $hGDIBitmapSysMenueCloseAkt, $hTmp_Bitmap, $hTmp_Buffer, $hGDIBitmapSysMenueMiniAkt, $hGDIBitmapAutoItIcon, $GDIAnz
Global $aGUI[$GUIAnz], $aGDI[$GDIAnz], $aRegions[4][4]
_GUICreate("Mein Fenster", 400, 400)
[/autoit] [autoit][/autoit] [autoit]While 1
Sleep(100)
WEnd
Func _GUICreate($sTitle, $iWidth, $iHeight)
Opt("GUIOnEventMode", 1)
If $iWidth < 150 Then $iWidth = 150
If $iHeight < 40 Then $iHeight = 40
$aGUI[$GUITitle] = $sTitle
$aGUI[$GUIWidth] = $iWidth
$aGUI[$GUIHeight] = $iHeight
;~ $aGUI[$GUIMain] = GUICreate($aGUI[$GUITitle], $aGUI[$GUIWidth], $aGUI[$GUIHeight], -1, -1, 0x80000000)
$aGUI[$GUIMain] = GUICreate($aGUI[$GUITitle], $aGUI[$GUIWidth], $aGUI[$GUIHeight], -1, -1, 0x80000000, 0x00080000)
$aGUI[$hGUIMain] = WinGetHandle($aGUI[$GUIMain])
GUISetOnEvent(-3, "_exit")
$aGUI[$ScreenDc] = _WinAPI_GetDC($aGUI[$GUIMain])
$aGUI[$dc] = _WinAPI_CreateCompatibleDC($aGUI[$ScreenDc])
$aGUI[$tSize] = DllStructCreate($tagSIZE)
$aGUI[$pSize] = DllStructGetPtr( $aGUI[$tSize])
DllStructSetData($aGUI[$tSize], "X", $aGUI[$GUIWidth])
DllStructSetData($aGUI[$tSize], "Y", $aGUI[$GUIHeight])
$aGUI[$tSource] = DllStructCreate($tagPOINT)
$aGUI[$pSource] = DllStructGetPtr($aGUI[$tSource])
$aGUI[$tBlend] = DllStructCreate($tagBLENDFUNCTION)
$aGUI[$pBlend] = DllStructGetPtr($aGUI[$tBlend])
DllStructSetData($aGUI[$tBlend], "Alpha", 255)
DllStructSetData($aGUI[$tBlend], "Format", 1)
$aGUI[$tPoint] = DllStructCreate($tagPOINT)
$aGUI[$pPoint] = DllStructGetPtr($aGUI[$tPoint])
DllStructSetData($aGUI[$tPoint], "X", 0)
DllStructSetData($aGUI[$tPoint], "Y", 0)
GUISetState()
[/autoit] [autoit][/autoit] [autoit]GUI_Register_Hover($aGUI[$hGUIMain],0,0,1,1,"nix");Standardmässig mein ersten mal sonst kackt meine UDF ab.
Init_GDI()
Draw_Border_Client_SysMenue()
Update_Window()
EndFunc
Func Init_GDI()
_GDIPlus_Startup()
$aGDI[$hGDIGraphic] = _GDIPlus_GraphicsCreateFromHWND($aGUI[$hGUIMain])
$aGDI[$hGDIBitmap] = _GDIPlus_BitmapCreateFromGraphics($aGUI[$GUIWidth], $aGUI[$GUIHeight], $aGDI[$hGDIGraphic])
$aGDI[$hGDIBuffer] = _GDIPlus_ImageGetGraphicsContext($aGDI[$hGDIBitmap])
$aGDI[$hGDIBitmapCornerUPLeft] = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\Alle Bilder\CornerUPLeft.png")
$aGDI[$hGDIBitmapCornerUPRight] = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\Alle Bilder\CornerUPRight.png")
$aGDI[$hGDIBitmapCornerDownLeft] = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\Alle Bilder\CornerDownLeft.png")
$aGDI[$hGDIBitmapCornerDownRight] = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\Alle Bilder\CornerDownRight.png")
$aGDI[$hGDIBitmapBorderUP] = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\Alle Bilder\BorderUP.png")
$aGDI[$hGDIBitmapBorderLeftRight] = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\Alle Bilder\BorderLeftRight.png")
$aGDI[$hGDIBitmapBorderDown] = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\Alle Bilder\BorderDown.png")
$aGDI[$hGDIBitmapSysMenueMini] = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\Alle Bilder\SysMenueMini.png")
$aGDI[$hGDIBitmapSysMenueMaxiDea] = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\Alle Bilder\SysMenueMaxiDea.png")
$aGDI[$hGDIBitmapSysMenueClose] = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\Alle Bilder\SysMenueClose.png")
$aGDI[$hGDIBitmapSysMenueCloseAkt] = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\Alle Bilder\SysMenueCloseAkt.png")
$aGDI[$hGDIBitmapSysMenueMiniAkt] = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\Alle Bilder\SysMenueMiniAkt.png")
$aGDI[$hGDIBitmapAutoItIcon] = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\Alle Bilder\au3.ico")
$aGDI[$hBrushRectClient] = _GDIPlus_BrushCreateSolid("0x" & Hex(255, 2) & Hex(240, 2) & Hex(240, 2) & Hex(240, 2))
EndFunc
Func Draw_Border_Client_SysMenue()
#region Corner UP Left
$iW_CornerUPLeft = _GDIPlus_ImageGetWidth($aGDI[$hGDIBitmapCornerUPLeft])
$iH_CornerUPLeft = _GDIPlus_ImageGetHeight($aGDI[$hGDIBitmapCornerUPLeft])
_GDIPlus_GraphicsDrawImageRect($aGDI[$hGDIBuffer], $aGDI[$hGDIBitmapCornerUPLeft], 0, 0, $iW_CornerUPLeft, $iH_CornerUPLeft )
#endregion
#region Corner UP Right
$iW_CornerUPRight = _GDIPlus_ImageGetWidth($aGDI[$hGDIBitmapCornerUPRight])
$iH_CornerUPRight = _GDIPlus_ImageGetHeight($aGDI[$hGDIBitmapCornerUPRight])
_GDIPlus_GraphicsDrawImageRect($aGDI[$hGDIBuffer], $aGDI[$hGDIBitmapCornerUPRight], $aGUI[$GUIWidth]-$iW_CornerUPRight, 0, $iW_CornerUPRight, $iH_CornerUPRight )
#endregion
#region Border UP
$iW_BorderUP = _GDIPlus_ImageGetWidth($aGDI[$hGDIBitmapBorderUP])
$iH_BorderUP = _GDIPlus_ImageGetHeight($aGDI[$hGDIBitmapBorderUP])
For $i = $iW_CornerUPLeft To $aGUI[$GUIWidth]-$iW_CornerUPRight
_GDIPlus_GraphicsDrawImageRect($aGDI[$hGDIBuffer], $aGDI[$hGDIBitmapBorderUP], $i, 0, $iW_BorderUP, $iH_BorderUP )
Next
#endregion
#region Corner Down Left
$iW_CornerDownLeft = _GDIPlus_ImageGetWidth($aGDI[$hGDIBitmapCornerDownLeft])
$iH_CornerDownLeft = _GDIPlus_ImageGetHeight($aGDI[$hGDIBitmapCornerDownLeft])
_GDIPlus_GraphicsDrawImageRect($aGDI[$hGDIBuffer], $aGDI[$hGDIBitmapCornerDownLeft], 0,$aGUI[$GUIHeight]-$iH_CornerDownLeft, $iW_CornerDownLeft, $iH_CornerDownLeft )
#endregion
#region Border Left
$iW_BorderLeftRight = _GDIPlus_ImageGetWidth($aGDI[$hGDIBitmapBorderLeftRight])
$iH_BorderLeftRight = _GDIPlus_ImageGetHeight($aGDI[$hGDIBitmapBorderLeftRight])
For $i = $iH_CornerUPLeft To $aGUI[$GUIHeight]-$iH_CornerDownLeft
_GDIPlus_GraphicsDrawImageRect($aGDI[$hGDIBuffer], $aGDI[$hGDIBitmapBorderLeftRight], 0, $i, $iW_BorderLeftRight, $iH_BorderLeftRight )
Next
#endregion
#region Corner Down Right
$iW_CornerDownRight = _GDIPlus_ImageGetWidth($aGDI[$hGDIBitmapCornerDownRight])
$iH_CornerDownRight = _GDIPlus_ImageGetHeight($aGDI[$hGDIBitmapCornerDownRight])
_GDIPlus_GraphicsDrawImageRect($aGDI[$hGDIBuffer], $aGDI[$hGDIBitmapCornerDownRight], $aGUI[$GUIWidth]-$iW_CornerDownRight ,$aGUI[$GUIHeight]-$iH_CornerDownLeft, $iW_CornerDownRight, $iH_CornerDownRight )
#endregion
#region Border Right
For $i = $iH_CornerUPRight To $aGUI[$GUIHeight]-$iH_CornerDownRight
_GDIPlus_GraphicsDrawImageRect($aGDI[$hGDIBuffer], $aGDI[$hGDIBitmapBorderLeftRight], $aGUI[$GUIWidth]-$iW_BorderLeftRight, $i, $iW_BorderLeftRight, $iH_BorderLeftRight )
Next
#endregion
#region Border Down
$iW_BorderDown = _GDIPlus_ImageGetWidth($aGDI[$hGDIBitmapBorderDown])
$iH_BorderDown = _GDIPlus_ImageGetHeight($aGDI[$hGDIBitmapBorderDown])
For $i = $iW_CornerDownLeft To $aGUI[$GUIWidth]-$iW_CornerDownRight
_GDIPlus_GraphicsDrawImageRect($aGDI[$hGDIBuffer], $aGDI[$hGDIBitmapBorderDown], $i, $aGUI[$GUIHeight]-$iH_CornerDownRight, $iW_BorderDown, $iH_BorderDown )
Next
#endregion
#region Client
_GDIPlus_GraphicsFillRect($aGDI[$hGDIBuffer], $iW_BorderLeftRight, $iH_BorderUP, $aGUI[$GUIWidth]-$iW_BorderLeftRight*2, $aGUI[$GUIHeight]-$iH_BorderUP-$iH_BorderDown,$aGDI[$hBrushRectClient])
#endregion
#region SysMenueClose
$iW_SysMenueClose = _GDIPlus_ImageGetWidth($aGDI[$hGDIBitmapSysMenueClose])
$iH_SysMenueClose = _GDIPlus_ImageGetHeight($aGDI[$hGDIBitmapSysMenueClose])
_GDIPlus_GraphicsDrawImageRect($aGDI[$hGDIBuffer], $aGDI[$hGDIBitmapSysMenueClose], $aGUI[$GUIWidth]-$iW_CornerUPRight-$iW_SysMenueClose ,1, $iW_SysMenueClose, $iH_SysMenueClose )
#endregion
#region SysMenueMaxiDea
$iW_SysMenueMaxiDea = _GDIPlus_ImageGetWidth($aGDI[$hGDIBitmapSysMenueMaxiDea])
$iH_SysMenueMaxiDea = _GDIPlus_ImageGetHeight($aGDI[$hGDIBitmapSysMenueMaxiDea])
_GDIPlus_GraphicsDrawImageRect($aGDI[$hGDIBuffer], $aGDI[$hGDIBitmapSysMenueMaxiDea], $aGUI[$GUIWidth]-$iW_CornerUPRight-$iW_SysMenueClose-$iW_SysMenueMaxiDea ,1, $iW_SysMenueMaxiDea, $iH_SysMenueMaxiDea )
#endregion
#region SysMenueMaxiDea
$iW_SysMenueMini = _GDIPlus_ImageGetWidth($aGDI[$hGDIBitmapSysMenueMini])
$iH_SysMenueMini = _GDIPlus_ImageGetHeight($aGDI[$hGDIBitmapSysMenueMini])
_GDIPlus_GraphicsDrawImageRect($aGDI[$hGDIBuffer], $aGDI[$hGDIBitmapSysMenueMini], $aGUI[$GUIWidth]-$iW_CornerUPRight-$iW_SysMenueClose-$iW_SysMenueMaxiDea-$iW_SysMenueMini ,1, $iW_SysMenueMini, $iH_SysMenueMini )
#endregion
#region Set Regions
$aRegions[0][0] = 0
$aRegions[0][1] = 0
$aRegions[0][2] = ($aGUI[$GUIWidth]-$iW_CornerUPRight-$iW_SysMenueClose-$iW_SysMenueMaxiDea-$iW_SysMenueMini)-$aRegions[0][0]-1
$aRegions[0][3] = $iH_BorderUP-$aRegions[0][1]
GUI_Register_Hover($aGUI[$hGUIMain],$aRegions[0][0],$aRegions[0][1],$aRegions[0][2],$aRegions[0][3],"HoverTitle",-1,0)
;=>Titelleiste
$aRegions[1][0] = $aGUI[$GUIWidth]-$iW_CornerUPRight-$iW_SysMenueClose-$iW_SysMenueMaxiDea-$iW_SysMenueMini
$aRegions[1][1] = 0
$aRegions[1][2] = $iW_SysMenueMini
$aRegions[1][3] = $iH_SysMenueMini-$aRegions[0][1]
GUI_Register_Hover($aGUI[$hGUIMain],$aRegions[1][0],$aRegions[1][1],$aRegions[1][2],$aRegions[1][3],"HoverSysMenueMiniHide",-1,0)
GUI_Register_Hover($aGUI[$hGUIMain],$aRegions[1][0],$aRegions[1][1],$aRegions[1][2],$aRegions[1][3],"HoverSysMenueMini","Update_Window")
;=>MinimizeBox
$aRegions[2][0] = $aGUI[$GUIWidth]-$iW_CornerUPRight-$iW_SysMenueClose-$iW_SysMenueMaxiDea
$aRegions[2][1] = 0
$aRegions[2][2] = $iW_SysMenueMaxiDea
$aRegions[2][3] = $iH_SysMenueMaxiDea-$aRegions[0][1]
;=>MaxBox
$aRegions[3][0] = $aGUI[$GUIWidth]-$iW_CornerUPRight-$iW_SysMenueClose
$aRegions[3][1] = 0
$aRegions[3][2] = $iW_SysMenueClose
$aRegions[3][3] = $iH_SysMenueClose-$aRegions[0][1]
GUI_Register_Hover($aGUI[$hGUIMain],$aRegions[3][0],$aRegions[3][1],$aRegions[3][2],$aRegions[3][3],"HoverSysMenueCloseonlyExit",-1,0)
GUI_Register_Hover($aGUI[$hGUIMain],$aRegions[3][0],$aRegions[3][1],$aRegions[3][2],$aRegions[3][3],"HoverSysMenueClose","Update_Window")
;=>CloseBox
#endregion
#region Icon
_GDIPlus_GraphicsDrawImageRect($aGDI[$hGDIBuffer], $aGDI[$hGDIBitmapAutoItIcon],$iW_BorderLeftRight,7,16,16)
#endregion
#region Title
$aTitle = StringSplit($aGUI[$GUITitle],"")
$sTitle = ""
If $aTitle[0] > Round($aRegions[0][2]/7) Then
For $i = 1 To Round($aRegions[0][2]/7)-5
$sTitle &= $aTitle[$i]
Next
$sTitle &= "..."
_GDIPlus_GraphicsDrawString($aGDI[$hGDIBuffer], $sTitle, $iW_BorderLeftRight+16+5, 7, "Arial",10)
Else
_GDIPlus_GraphicsDrawString($aGDI[$hGDIBuffer], $aGUI[$GUITitle], $iW_BorderLeftRight+16+5, 7, "Arial",10)
EndIf
#endregion
;_ArrayDisplay($aRegions)
EndFunc
Func HoverSysMenueClose()
$aGDI[$hTmp_Bitmap] = _GDIPlus_BitmapCreateFromGraphics($aGUI[$GUIWidth], $aGUI[$GUIHeight], $aGDI[$hGDIGraphic])
;~ $aGDI[$hTmp_Bitmap] = _GDIPlus_BitmapCreateFromHBITMAP($aGDI[$hGDIBitmap])
$aGDI[$hTmp_Buffer] = _GDIPlus_ImageGetGraphicsContext($aGDI[$hTmp_Bitmap])
_GDIPlus_GraphicsDrawImage($aGDI[$hTmp_Buffer], $aGDI[$hGDIBitmap], 0, 0)
$iW_SysMenueCloseAkt = _GDIPlus_ImageGetWidth($aGDI[$hGDIBitmapSysMenueCloseAkt])
$iH_SysMenueCloseAkt = _GDIPlus_ImageGetHeight($aGDI[$hGDIBitmapSysMenueCloseAkt])
_GDIPlus_GraphicsDrawImageRect($aGDI[$hTmp_Buffer], $aGDI[$hGDIBitmapSysMenueCloseAkt], $aRegions[3][0]-6 ,0, $iW_SysMenueCloseAkt, $iH_SysMenueCloseAkt )
Local $gdibitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($aGDI[$hTmp_Bitmap])
_WinAPI_SelectObject($aGUI[$dc], $gdibitmap)
_WinAPI_UpdateLayeredWindow($aGUI[$GUIMain], $aGUI[$ScreenDc], 0, $aGUI[$pSize], $aGUI[$dc], $aGUI[$pSource], 0, $aGUI[$pBlend], 2)
_WinAPI_DeleteObject($gdibitmap)
EndFunc
Func HoverSysMenueCloseonlyExit()
If _IsPressed(01) Then Exit
EndFunc
Func HoverSysMenueMiniHide()
If _IsPressed(01) Then
GUISetState(@SW_MINIMIZE,$aGUI[$hGUIMain])
Update_Window()
EndIf
EndFunc
Func HoverSysMenueMini()
$aGDI[$hTmp_Bitmap] = _GDIPlus_BitmapCreateFromGraphics($aGUI[$GUIWidth], $aGUI[$GUIHeight], $aGDI[$hGDIGraphic])
;~ $aGDI[$hTmp_Bitmap] = _GDIPlus_BitmapCreateFromHBITMAP($aGDI[$hGDIBitmap])
$aGDI[$hTmp_Buffer] = _GDIPlus_ImageGetGraphicsContext($aGDI[$hTmp_Bitmap])
_GDIPlus_GraphicsDrawImage($aGDI[$hTmp_Buffer], $aGDI[$hGDIBitmap], 0, 0)
$iW_SysMenueMiniAkt = _GDIPlus_ImageGetWidth($aGDI[$hGDIBitmapSysMenueMiniAkt])
$iH_SysMenueMiniAkt = _GDIPlus_ImageGetHeight($aGDI[$hGDIBitmapSysMenueMiniAkt])
_GDIPlus_GraphicsDrawImageRect($aGDI[$hTmp_Buffer], $aGDI[$hGDIBitmapSysMenueMiniAkt], $aRegions[1][0]-6 ,0, $iW_SysMenueMiniAkt, $iH_SysMenueMiniAkt )
Local $gdibitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($aGDI[$hTmp_Bitmap])
_WinAPI_SelectObject($aGUI[$dc], $gdibitmap)
_WinAPI_UpdateLayeredWindow($aGUI[$GUIMain], $aGUI[$ScreenDc], 0, $aGUI[$pSize], $aGUI[$dc], $aGUI[$pSource], 0, $aGUI[$pBlend], 2)
_WinAPI_DeleteObject($gdibitmap)
_GDIPlus_GraphicsClear($aGDI[$hTmp_Buffer])
EndFunc
Func HoverTitle()
If _IsPressed(01) Then
;ConsoleWrite("hover title" & @CRLF)
$aCursorInfo = GUIGetCursorInfo($aGUI[$hGUIMain])
Do
$aMousePos = MouseGetPos()
WinMove($aGUI[$GUIMain],"",$aMousePos[0]-$aCursorInfo[0],$aMousePos[1]-$aCursorInfo[1])
Sleep(10)
Until Not _IsPressed(01)
EndIf
EndFunc
Func Update_Window()
Local $gdibitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($aGDI[$hGDIBitmap])
_WinAPI_SelectObject($aGUI[$dc], $gdibitmap)
_WinAPI_UpdateLayeredWindow($aGUI[$GUIMain], $aGUI[$ScreenDc], 0, $aGUI[$pSize], $aGUI[$dc], $aGUI[$pSource], 0, $aGUI[$pBlend], 2)
_WinAPI_DeleteObject($gdibitmap)
EndFunc
Func _exit()
Exit
EndFunc