Hallo!
Ich habe eine GUI die ich mit Buttons belegt hab..nun habe ich eine andere GUI mit der ich auf den Bildschirm zeichne. Diese soll immer im Vordergrund sein! Soweit funzt das auch, nur wenn ich paarmal aufn Desktop klicke und wieder ins GUI zurück dann ist die Zeichnen-GUI im Hintergrund!
Wie kann ich das Zeichnen-GUI IMMER im Vordergrund halten? ..oder wieder inn Vordergrund bringen/zeichnen wenn es nicht im Vordergrund ist?
Gibts da sowas wie ne Z-Depth-Reihenfolge oder sowas?
P.S.: Hab Windows 7, Aero deaktiviert
Spoiler anzeigen
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#include <Misc.au3>
#include <Array.au3>
_GDIPlus_Startup()
;Transparente GUI erstellen
$hDummy = GUICreate("") ; Dummy GUI, damit richtiges nicht in Taskleiste auftaucht.
$hGUI = GUICreate("", @DesktopWidth, @DesktopHeight, 0, 0, BitOr($WS_CLIPSIBLINGS, $WS_POPUP), BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST,$WS_EX_TRANSPARENT),$hDummy)
GUISetBkColor(0xABCDEF, $hGUI)
_WinAPI_SetLayeredWindowAttributes($hGUI, 0xABCDEF, 255)
;Graphic-Objekt, Pinsel und Backbuffer erstellen und GUI anzeigen
$hBrush = _GDIPlus_BrushCreateSolid (0xEE000000)
$hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI)
$hBitmap = _GDIPlus_BitmapCreateFromGraphics(@DesktopWidth, @DesktopHeight, $hGraphics)
$hBackBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
_GDIPlus_GraphicsSetSmoothingMode($hBackbuffer, 2)
GUISetState(@SW_SHOW);NOACTIVATE)
_Zentriere("Fischer, wie tief ist das Wasser?", @DesktopWidth / 2, @DesktopHeight / 5, 36, "Arial", $hBackbuffer)
_GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap, 0, 0)
#Region ### START Koda GUI section ### Form=C:\Users\IBM\Desktop\Projekte\Heikos_Klicker\Autoit_Abstimmung\Abstimmung.kxf
$Form1_1 = GUICreate("Form1", 712, 650, -1, -1)
$Group1 = GUICtrlCreateGroup("", 6, 0, 697, 58, BitOR($GUI_SS_DEFAULT_GROUP,$WS_CLIPSIBLINGS))
$bStart = GUICtrlCreateButton("Start", 210, 12, 59, 37)
$bDEL = GUICtrlCreateButton("DEL", 282, 12, 59, 37)
$bCorrAntw = GUICtrlCreateButton("ANTW", 354, 12, 59, 37)
$bDiagr = GUICtrlCreateButton("diagramm", 426, 12, 59, 37)
$bPreQS = GUICtrlCreateButton("prev", 510, 12, 71, 37)
$bNextQS = GUICtrlCreateButton("next", 618, 12, 71, 37)
$Button7 = GUICtrlCreateButton("Button1", 117, 12, 71, 37)
$inpTime = GUICtrlCreateInput("inpTime", 60, 20, 49, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_RIGHT))
$lTime = GUICtrlCreateLabel("Zeit:", 18, 19, 36, 21, BitOR($SS_CENTER,$SS_CENTERIMAGE))
GUICtrlSetFont(-1, 10, 800, 4, "MS Sans Serif")
$lQS = GUICtrlCreateLabel("1/1", 582, 19, 36, 23, BitOR($SS_CENTER,$SS_CENTERIMAGE))
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Label1 = GUICtrlCreateLabel("Vorlesungs-ID für Abstimmung:", 6, 614, 296, 29)
GUICtrlSetFont(-1, 14, 800, 0, "@Arial Unicode MS")
$Label2 = GUICtrlCreateLabel("Stimmen", 618, 614, 86, 29)
GUICtrlSetFont(-1, 14, 800, 0, "@Arial Unicode MS")
$lVotes = GUICtrlCreateLabel("0", 593, 614, 16, 29, $SS_CENTER)
GUICtrlSetFont(-1, 14, 800, 0, "@Arial Unicode MS")
$lID = GUICtrlCreateLabel("222", 306, 614, 40, 29, $SS_CENTER)
GUICtrlSetFont(-1, 14, 800, 0, "@Arial Unicode MS")
$gOUT = GUICtrlCreateGraphic(30, 72, 650, 320, BitOR($GUI_SS_DEFAULT_GRAPHIC,$SS_CENTER,$SS_CENTERIMAGE))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
;$hWnd = GUICtrlGetHandle($gOUT)
;_GDIPlus_Startup ()
;~ $hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hWnd)
;~ $hBrush = _GDIPlus_BrushCreateSolid (0xcf000000)
;~ $hBitmap = _GDIPlus_BitmapCreateFromGraphics(650, 320, $hGraphic)
;~ $hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
;~ _GDIPlus_GraphicsSetSmoothingMode($hBackbuffer, 2)
;~ ;Zeichne Fragen und Antworten auf GraphicHWND
;~ _Zentriere("Fischer, wie tief ist das Wasser?", 325, 40, 36, "Arial", $hBackbuffer) ;_Zentriere($STRING, $X, $Y, $Grösse, $Schrift, BackBuffer/Graphic)
;~ _Zentriere("Frage 1" & @CRLF & "Frage 2" & @crlf & "Frage 3" & @CRLF & "Frage 4", 325, 180, 28, "Arial", $hBackbuffer)
;~ _GDIPlus_GraphicsDrawImage($hGraphic, $hBitmap, 0, 0)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_ImageDispose($hBackBuffer)
_GDIPlus_BrushDispose($hBrush)
_GDIPlus_Shutdown()
Exit
Case $bDEL
$aList = WinList()
_ArrayDisplay($aList)
EndSwitch
WEnd
Func _Zentriere($sString, $iX, $iY, $fSize, $sFont, $hGfxBuffer)
Local $aResult = DllCall($ghGDIPDLL, "uint", "GdipCreatePath", "int", 0, "int*", 0)
Local $hPath = $aResult[2]
Local $hFormat = _GDIPlus_StringFormatCreate()
Local $hFamily = _GDIPlus_FontFamilyCreate($sFont)
Local $tLayout = _GDIPlus_RectFCreate(0, 0, 0, 0)
Local $tBounds = _GDIPlus_RectFCreate(0, 0, 0, 0)
DllCall($ghGDIPDLL, "uint", "GdipAddPathString", "hwnd", $hPath, "wstr", $sString, "int", -1, "hwnd", $hFamily, "int", 0, "float", $fSize, "ptr", DllStructGetPtr($tLayout), "hwnd", $hFormat)
DllCall($ghGDIPDLL, "uint", "GdipGetPathWorldBounds", "hwnd", $hPath, "ptr", DllStructGetPtr($tBounds), "hwnd", 0, "hwnd", 0)
Local $fRectX = DllStructGetData($tBounds, "X")
Local $fRectY = DllStructGetData($tBounds, "Y")
Local $fRectW = DllStructGetData($tBounds, "Width")
Local $fRectH = DllStructGetData($tBounds, "Height")
Local $hMatrix = _GDIPlus_MatrixCreate()
;Rechteck um Schrift zeichnen
$hBrush1 = _GDIPlus_BrushCreateSolid (0xFFEFEFEF)
_GDIPlus_GraphicsFillRect($hGfxBuffer, (@DesktopWidth / 2) - ($fRectW / 2) - 2, (@DesktopHeight / 5) - ($fRectH / 2) - 2, $fRectW + 6, $fRectH + 4, $hBrush1)
_GDIPlus_MatrixTranslate($hMatrix, -$fRectX - $fRectW / 2 + $iX, -$fRectY - $fRectH / 2 + $iY)
DllCall($ghGDIPDLL, "uint", "GdipTransformPath", "hwnd", $hPath, "hwnd", $hMatrix)
_GDIPlus_MatrixDispose($hMatrix)
DllCall($ghGDIPDLL, "uint", "GdipFillPath", "hwnd", $hGfxBuffer, "hwnd", $hBrush, "hwnd", $hPath)
_GDIPlus_FontFamilyDispose($hFamily)
_GDIPlus_StringFormatDispose($hFormat)
DllCall($ghGDIPDLL, "uint", "GdipDeletePath", "hwnd", $hPath)
EndFunc ;==>_Zentriere