Es geht nicht Weiß einer warum? Als X Wert bekomme ich "-1" und als Y Wert "0" ..?
Hast du meine Version nicht ausprobiert? Da ist das mit der größe schon drin und Funktioniert ( bei mir jedenfalls
)
Es geht nicht Weiß einer warum? Als X Wert bekomme ich "-1" und als Y Wert "0" ..?
Hast du meine Version nicht ausprobiert? Da ist das mit der größe schon drin und Funktioniert ( bei mir jedenfalls
)
Du hattest das \ vergessen darum hat er das Bild nicht abgespeichert.
#include <ScreenCapture.au3>
#Include <GDIPlus.au3>
_GDIPlus_Startup()
HotKeySet("{NUMPAD0}", "_start")
HotKeySet("{NUMPAD9}", "_ende")
HotKeySet("{PGUP}", "_Bildshow")
Global $Bildheight
Global $Bildwidth
While 1
Sleep(1000)
WEnd
Func _start()
MsgBox(64, "Info", "Bewege die Maus zur oberen linken Ecke des zu speichernden Bildes")
Sleep(2000)
$pos1 = MouseGetPos()
MsgBox(64, "Info", "Nun zur unteren rechten Ecke des Bildes")
Sleep(2000)
$pos2 = MouseGetPos()
$hbitmap=_ScreenCapture_Capture(@ScriptDir&"\test.jpg", $pos1[0], $pos1[1], $pos2[0], $pos2[1])
$hImage=_GDIPlus_ImageLoadFromFile(@ScriptDir&"\test.jpg")
$Bildwidth = _GDIPlus_ImageGetWidth($hImage)
$Bildheight = _GDIPlus_ImageGetHeight($hImage)
MsgBox(64, "Info", "Bild gespeichert. Mit Bildauf kannst du es betrachten")
MsgBox(64, "Info", "Es ist "&$Bildwidth&" breit und "&$Bildheight&" hoch.")
EndFunc
Func _ende()
_GDIPlus_ImageDispose($Bildwidth)
_GDIPlus_ImageDispose($Bildheight)
_GDIPlus_Shutdown()
Exit
EndFunc
Func _Bildshow()
If FileExists(@ScriptDir&"\test.jpg") Then Run("MSPaint.exe " & '"' & @ScriptDir & '\test.jpg"')
EndFunc
ich teste - danke
Und wie positioniere ich eine Messagebox an bestimmter Stelle auf dem Bildschirm?
Die wird ja immer verdeckt, weil sie mittig eingeblendet wird.
Schnuffel:
Damit unterbreche ich mein Programm um eine neue Markierung in meinem (email) Text anzubringen....wird schon immer besser...
Messageboxen gehen glaubich nur mittig. Aber du kannst der Msgbox Topmost Attribut geben, dann wird sie nicht mehr verdeckt. Flag 262144 ist Topmost mit Ok Button.
Beispiel:
MsgBox(262144,"Immer oben","Ich bin immer oben")
[/autoit]While ProcessExists ( "XP-SideBar.exe" )
.
.
.
WEnd
Alles anzeigenso sollte es gehen ...
Spoiler anzeigen
[autoit]Opt("WinTitleMatchMode",2)
[/autoit] [autoit][/autoit] [autoit]
#Include <Date.au3>
$title=WinGetTitle("Mein Spiel")
$timestart = _NowTime()
AdlibEnable("_SetTimeInTitle",1000)#include <GUIConstants.au3>
[/autoit] [autoit][/autoit] [autoit]
GUICreate('')
GUISetState()
While 1
$msg = GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEndFunc _SetTimeInTitle()
[/autoit]
$timeset = _DateDiff('s',"1970/01/01 "&$timestart, "1970/01/01 "&_NowTime())
$hour = Round($timeset/3600,0)
$min = Round(($timeset-($hour*3600))/60,0)
$sec = $timeset-($hour*3600)-($min*60)/60
If $hour < 10 Then $hour = "0" & $hour
If $min <10 Then $min = "0" & $min
If $sec < 10 Then $sec = "0" & $sec
WinSetTitle($title,"",$title& " ----- " & $hour&":"&$min&":"&$sec)
EndFunc
Das Funktioniert dann immer nur bei einem Title und wenn man WinGetTitle noch rein macht verdoppelt sich das dann die ganze Zeit.
Man muss das glaubich irgendwie mit den String Funktionen Trimen oder so.
Hab mir das auch schnell für ein Spiel geschrieben.
Opt("WinTitleMatchMode",2)
[/autoit] [autoit][/autoit] [autoit]Global $title[5]=["Diablo II - Gegenstand aufgehoben","Diablo II - Monster in Sicht","Diablo II - Leben leer","Diablo II - Mana leer","Diablo II - Sie sind gestorben"]
[/autoit] [autoit][/autoit] [autoit]While 1
Sleep ( 3000 )
WinSetTitle("Diablo II","",$title[Random(0,4,1)])
WEnd
Komm aber jetzt auch nicht drauf...
Brauchste Opt("WinTitleMatchMode",2) damit er immer das Fenster findet mit "Mein Spiel".
Dann in eine Schleife noch, müsste glaubich ungefair so aussehen:
[autoit]Opt("WinTitleMatchMode",2)
[/autoit][autoit][/autoit][autoit]$title=WinGetTitle("Mein Spiel")
WinSetTitle("Mein Spiel","",$title& " ----- " & $hour & " : " & $min & " : " & $count)
Wie sieht den dein Code mitlerweile aus?
Das Bild ist jpg und kein gif.
Hier nen Beispiel:
#cs ----------------------------------------------------------------------------
[/autoit] [autoit][/autoit] [autoit]AutoIt Version: 3.3.0.0
Author: myName
Script Function:
Template AutoIt script.
#ce ----------------------------------------------------------------------------
[/autoit] [autoit][/autoit] [autoit];~ ; Script Start - Add your code below here
[/autoit] [autoit][/autoit] [autoit]$pfad = FileExists ("data.ini")
If $pfad = 1 Then
Sleep(200)
ElseIf $pfad = 0 Then
$pfad = InputBox("PFAD", "Geben Sie hier ihren Pfad zu GTA San Anreas an. Bitte ohne .exe")
IniWrite("data.ini", "Pfad", "Pfad", $pfad)
EndIf
$pfadlesen = IniRead("data.ini", "Pfad", "Pfad", "default")
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("GTA Starter", 635, 293, 187, 122)
$Pic1 = GUICtrlCreatePic(@DocumentsCommonDir & '\Eigene Bilder\Beispielbilder\Winter.jpg', 0, 0, 635, 293)
GuiCtrlSetState(-1,$GUI_DISABLE)
$Start = GUICtrlCreateButton("Start", 72, 112, 137, 41)
$Exit = GUICtrlCreateButton("Exit", 248, 112, 137, 41)
$Label1 = GUICtrlCreateLabel("Start/Exit", 72, 88, 48, 17)
GUICtrlSetColor(-1, 0xFF0000)
$Label2 = GUICtrlCreateLabel("Dies ist ein GTA SA:MP Start. Mit diesem Starter kann man problemlos den SA:MP starten.", 32, 16, 429, 17)
GUICtrlSetColor(-1, 0xFF0000)
$Label3 = GUICtrlCreateLabel("Tools", 480, 56, 30, 17)
GUICtrlSetColor(-1, 0xFF0000)
$Button1 = GUICtrlCreateButton("GTAInside", 472, 96, 153, 41, $WS_GROUP)
$Button2 = GUICtrlCreateButton("GTA Mod Installer", 472, 152, 153, 41, $WS_GROUP)
$Label4 = GUICtrlCreateLabel("Achtung! Der GTA Mod Installer muss im GTA San Andreas Verzeichnis installiert sein!",472, 200, 175, 50)
GUICtrlSetColor(-1, 0xFF0000)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Start
Startsamp()
Case $Exit
exitsamp()
Case $Button1
inside()
;Case $mod
;gtamod()
EndSwitch
WEnd
Func startsamp()
userdata()
ShellExecute($pfadlesen & "samp.exe")
EndFunc
Func exitsamp()
Exit("samp.exe")
EndFunc
Func inside()
Run (@ScriptDir &"/GTAInside.htm")
EndFunc
Func userdata()
FileCopy($pfadlesen & "USERDATA.dat", @ScriptDir)
EndFunc
Bei dir fehlt auch noch ein \
@ProgramFilesDir & "GTA.gif"
also so dann
@ProgramFilesDir & "\GTA.gif"
ZitatWird ein Bild als Hintergrundbild genutzt, während die anderen Steuerelemente dieses quasi überlappen, so ist es wichtig, das Bild-Steuerelement zu deaktivieren und es nach den anderen Steuerelementen zu erstellen: GuiCtrlSetState(-1,$GUI_DISABLE).
ist GUICtrlSetImage auch der richtige Befehl für sowas?
ZitatSets the bitmap or icon image to use for a control.
Machs doch so:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$Path = @ScriptDir & "\wdimg.jpg"
[/autoit] [autoit][/autoit] [autoit]$Form1 = GUICreate("Form1", 691, 331, 177, 230)
$Button1 = GUICtrlCreateButton("Temperatur", 8, 8, 75, 25, $WS_GROUP)
$Button2 = GUICtrlCreateButton("Luftfeuchte", 8, 40, 75, 25, $WS_GROUP)
$Button3 = GUICtrlCreateButton("Niederschlag", 8, 72, 75, 25, $WS_GROUP)
$Button4 = GUICtrlCreateButton("Windgeschw.", 8, 104, 75, 25, $WS_GROUP)
$Button5 = GUICtrlCreateButton("Windboen", 8, 136, 75, 25, $WS_GROUP)
$Button6 = GUICtrlCreateButton("Sonnenschein", 8, 168, 75, 25, $WS_GROUP)
$Button7 = GUICtrlCreateButton("Luftdruck", 8, 200, 75, 25, $WS_GROUP)
$Pic1 = GUICtrlCreatePic($Path, 88, 8, 592, 312, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))
$Button8 = GUICtrlCreateButton("Aktualisieren", 8, 232, 75, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
If FileExists($Path) Then FileDelete($Path)
InetGet("http://www.wetter-haltern.de/wetter/charts/mini_currentt.gif", $Path, 1)
GUICtrlDelete($Pic1)
Sleep ( 2000 ) ; Zur Veranschaulichung das es Funktioniert
$Pic1 = GUICtrlCreatePic($Path, 88, 8, 592, 312, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))
EndSwitch
WEnd
Also mit
[autoit]@MyDocumentsDir
[/autoit]biste bei deinen Eignen Dateien
Also
ShellExecute(@MyDocumentsDir)
[/autoit][autoit]Filemove
[/autoit]die Datei verschieben, mit dem Marco weist du wohin, dann nur noch ausführen mit ShellExecute oder Run.
Es gibt doch die deutsche Hilfe, Klick mich
Einfach Style $WS_EX_TOOLWINDOW nehmen:
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 633, 447, 192, 124, -1, $WS_EX_TOOLWINDOW)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Hab die UDF noch gefunden und den 2 Parameter Style noch hinzugefügt.
0, ist zentriert, 1 ist nebeneinander, 2 ist gestreckt.
$file="C:\Dokumente und Einstellungen\ackermann\Desktop\Unbenannt.bmp"
ChangeDesktopWallpaper($file,0)
Func ChangeDesktopWallpaper($bmp,$style=2)
;===============================================================================
; Usage: _ChangeDesktopWallPaper(@WindowsDir & '\' & 'zapotec.bmp')
; Parameter(s): $bmp - Full Path to BitMap File (*.bmp)
; $style - 0=Center, 1=tile windows, 2=stretched Edit by Greek
; Requirement(s): None.
; Return Value(s): On Success - Returns 0
; On Failure - -1
;===============================================================================
If Not FileExists($bmp) Then Return -1
;The $SPI* values could be defined elsewhere via #include - if you conflict,
; remove these, or add if Not IsDeclared "SPI_SETDESKWALLPAPER" Logic
Local $SPI_SETDESKWALLPAPER = 20
Local $SPIF_UPDATEINIFILE = 1
Local $SPIF_SENDCHANGE = 2
Local $REG_DESKTOP= "HKEY_CURRENT_USER\Control Panel\Desktop"
RegWrite($REG_DESKTOP, "TileWallPaper", "REG_SZ", $style)
RegWrite($REG_DESKTOP, "WallpaperStyle", "REG_SZ", $style)
RegWrite($REG_DESKTOP, "Wallpaper", "REG_SZ", $bmp)
DllCall("user32.dll", "int", "SystemParametersInfo", _
"int", $SPI_SETDESKWALLPAPER, _
"int", 0, _
"str", $bmp, _
"int", BitOR($SPIF_UPDATEINIFILE, $SPIF_SENDCHANGE))
Return 0
EndFunc;==>_ChangeDestopWallpaper
Suchste das?:
#include <Array.au3>
[/autoit] [autoit][/autoit] [autoit]Global $averagearr[1], $buffer = 0
[/autoit] [autoit][/autoit] [autoit]$speedaktual = 2
; $speedaktual = 1
$url = "http://www.autoitscript.com/cgi-bin/getfile.pl?autoit3/autoit-v3-setup.exe"
[/autoit] [autoit][/autoit] [autoit]Global $iFileSize = InetGetSize($url)
InetGet($url, @DesktopDir & "\autoit-v3-setup.exe", 1, 1)
ProgressOn('Test', '')
[/autoit] [autoit][/autoit] [autoit]$time = TimerInit()
While @InetGetActive
$iLastKbits = @InetGetBytesRead / 1024
Sleep($speedaktual * 100)
$iNewKbits = @InetGetBytesRead / 1024
$speed = ($iNewKbits - $iLastKbits) / ($speedaktual / 10)
$iPercent = Round(@InetGetBytesRead / $iFileSize * 100)
ProgressSet($iPercent, " Noch " & _average($speed) & " sec ; " & ' ' & $speed & ' Kb/s')
WEnd
ProgressOff()
[/autoit] [autoit][/autoit] [autoit]Func _average($a)
If $a <> 0 Then
_ArrayAdd($averagearr, $a)
For $i = 1 To UBound($averagearr) - 1
$buffer += $averagearr[$i]
Next
$buffer /= UBound($averagearr) - 1
$buffer2 = $buffer
$buffer = 0
Return Round((($iFileSize - @InetGetBytesRead) / 1024) / $buffer2)
EndIf
EndFunc ;==>_average
#include <Misc.au3>
Dim $count=0
While 1
If _isPressed(41) Then
While _isPressed(41)
Sleep(10)
WEnd
$count += 1
EndIf
If $count=2 Then
Msgbox(64,"info","A 2x gedrückt")
EndIf
Sleep(10)
WEnd
Bekomm hier in letzter Zeit auch einen Fehler:
Fatal error: Connecting to MySQL server 'localhost' failed.
You get more information about the problem in our knowledge base: http://www.woltlab.com/help/?code=1040
Information:
error message: Connecting to MySQL server 'localhost' failed.
error code: 1040
sql type: MySQLDatabase
sql error: Too many connections
sql error number: 1040
sql version:
file: /srv/www/vhosts/autoit.de/httpdocs/wcf/lib/system/database/MySQLDatabase.class.php (29)
php version: 5.2.9
wcf version: 1.0.11 pl 1 (Horizon)
date: Fri, 10 Jul 2009 14:17:41 +0000
request: /index.php?page=Portal
referer: http://www.autoit.de/index.php?page=Thread&threadID=4291&pageNo=2
Stacktrace:
#0 /srv/www/vhosts/autoit.de/httpdocs/wcf/lib/system/database/Database.class.php(76): MySQLDatabase->connect()
#1 /srv/www/vhosts/autoit.de/httpdocs/wcf/lib/system/WCF.class.php(270): Database->__construct(...)
#2 /srv/www/vhosts/autoit.de/httpdocs/wcf/lib/system/WCF.class.php(88): WCF->initDB()
#3 /srv/www/vhosts/autoit.de/httpdocs/global.php(18): WCF->__construct()
#4 /srv/www/vhosts/autoit.de/httpdocs/index.php(7): require_once('/srv/www/vhosts...')
#5 {main}
Alles anzeigen
Hab den nur ich?
Wenn nicht alles Parameter übergeben worden sind gibts Fehler, außer man macht sie optional und das geht so:
[autoit]$r=_myUDF(5,2,4) ;// Mit angaben .
MsgBox(0,"",$r)
$r=_myUDF(5) ;// Er rechnet einfach +3 , da $ZweiteZahl Standartmässig 3 ist und Operator + .
MsgBox(0,"",$r)
Func _myUDF($ersteZahl,$ZweiteZahl=3,$operator=1) ;// Einfach schon etwas eintragen .
Switch $operator
Case 1
$result=$ersteZahl+$ZweiteZahl
Case 2
$result=$ersteZahl-$ZweiteZahl
Case 3
$result=$ersteZahl*$ZweiteZahl
Case 4
$result=$ersteZahl/$ZweiteZahl
EndSwitch
Return $result
EndFunc
Rechtsklick drauf und auf Compile Script drücken.
Hm, versteh nicht ganz was du meinst, also entweder so: ( Was noch sinnvoll wäre )
;Author: Greek
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <GDIPlus.au3>
HotKeySet ("{ESC}","_CleanEnd")
[/autoit] [autoit][/autoit] [autoit]Global $GUIBreite=400
Global $GUIHoehe=150
$hGui=GUICreate("Uhr", $GUIBreite, $GUIHoehe, Default, Default, $WS_POPUP, BitOR($WS_EX_LAYERED,$WS_EX_TOOLWINDOW,$WS_EX_TOPMOST))
GUISetBkColor(0x000000)
GUICtrlCreateLabel("", 0, 0, $GUIBreite, $GUIHoehe, -1, $GUI_WS_EX_PARENTDRAG)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
_WinAPI_SetLayeredWindowAttributes($hGui, 0x000000, 255,0x02)
_GuiRoundCorners($hGui,0,0,400,150)
GUISetState()
GUIRegisterMsg(0x0003,"MY_WM_MOVE")
_GDIPlus_Startup()
$hGraphic=_GDIPlus_GraphicsCreateFromHWND($hGui)
$hBrush = _GDIPlus_BrushCreateSolid (0xFF00FF00)
$hFormat = _GDIPlus_StringFormatCreate ()
$hFamily = _GDIPlus_FontFamilyCreate ("Arial")
$hFont = _GDIPlus_FontCreate ($hFamily, 40, 2)
$tLayout = _GDIPlus_RectFCreate (85, 40, 300, 100)
_GDIPlus_GraphicsDrawStringEx ($hGraphic, @HOUR&":"&@MIN&":"&@SEC, $hFont, $tLayout, $hFormat, $hBrush)
AdlibEnable("_Update",1000)
[/autoit] [autoit][/autoit] [autoit]While 1
$pos=WinGetPos("Uhr")
$pos2=WinGetPos("Uhr")
If $pos[0] = $pos2[0] And $pos[1] = $pos2[1] Then
_WinAPI_SetLayeredWindowAttributes($hGui, 0x000000, 255,0x02)
EndIf
Sleep ( 200 )
WEnd
Func _WinAPI_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $dwFlages = 0x03, $isColorRef = False)
; progandy
If $dwFlages = Default Or $dwFlages = "" Or $dwFlages < 0 Then $dwFlages = 0x03
If Not $isColorRef Then
$i_transcolor = Hex(String($i_transcolor), 6)
$i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2))
EndIf
Local $Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hwnd, "long", $i_transcolor, "byte", $Transparency, "long", $dwFlages)
Select
Case @error
Return SetError(@error, 0, 0)
Case $Ret[0] = 0
Return SetError(4, _WinAPI_GetLastError(), 0)
Case Else
Return 1
EndSelect
EndFunc ;==>_WinAPI_SetLayeredWindowAttributes
Func MY_WM_MOVE()
_WinAPI_SetLayeredWindowAttributes($hGui, 0x000000, 0,0x01)
EndFunc
Func _Update()
_GDIPlus_GraphicsClear($hGraphic,0xFF000000)
_GDIPlus_GraphicsDrawStringEx ($hGraphic, @HOUR&":"&@MIN&":"&@SEC, $hFont, $tLayout, $hFormat, $hBrush)
EndFunc
Func _CleanEnd()
_GDIPlus_FontDispose ($hFont)
_GDIPlus_FontFamilyDispose ($hFamily)
_GDIPlus_StringFormatDispose ($hFormat)
_GDIPlus_BrushDispose ($hBrush)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_Shutdown ()
Exit
EndFunc
Func _GuiRoundCorners($hWnd, $x1, $y1, $x3, $y3)
Local $pos, $ret, $ret2
$pos = WinGetPos($hWnd)
$ret = DllCall('gdi32.dll', 'long', 'CreateRoundRectRgn', 'long', $x1, 'long', $y1, 'long', $pos[2], 'long', $pos[3], 'long', $x3, 'long', $y3)
If $ret[0] Then
$ret2 = DllCall('user32.dll', 'long', 'SetWindowRgn', 'hwnd', $hWnd, 'long', $ret[0], 'int', 1)
If $ret2[0] Then
Return 1
Else
Return 0
EndIf
Else
Return 0
EndIf
EndFunc
Oder so: ( was nicht nur dumm aussieht, sonder auch noch sehr lang brauch bis das Bild kommt )
;Author: Greek
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <GDIPlus.au3>
#Include <ScreenCapture.au3>
#Include <WinAPI.au3>
HotKeySet ("{ESC}","_CleanEnd")
[/autoit] [autoit][/autoit] [autoit]Global $pImageAttributes
Global $GUIBreite=400
Global $GUIHoehe=150
$hGui=GUICreate("Uhr", $GUIBreite, $GUIHoehe, Default, Default, $WS_POPUP, BitOR($WS_EX_LAYERED,$WS_EX_TOOLWINDOW,$WS_EX_TOPMOST))
GUISetBkColor(0x000000)
GUICtrlCreateLabel("", 0, 0, $GUIBreite, $GUIHoehe, -1, $GUI_WS_EX_PARENTDRAG)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
_WinAPI_SetLayeredWindowAttributes($hGui, 0x000000, 255,0x02)
_GuiRoundCorners($hGui,0,0,400,150)
GUISetState()
GUIRegisterMsg(0x0003,"MY_WM_MOVE")
_GDIPlus_Startup()
$hGraphic=_GDIPlus_GraphicsCreateFromHWND($hGui)
$hBrush = _GDIPlus_BrushCreateSolid (0xFF00FF00)
$hBrush2 = _GDIPlus_BrushCreateSolid (0xFF000000)
$hFormat = _GDIPlus_StringFormatCreate ()
$hFamily = _GDIPlus_FontFamilyCreate ("Arial")
$hFont = _GDIPlus_FontCreate ($hFamily, 40, 2)
$tLayout = _GDIPlus_RectFCreate (85, 40, 300, 100)
_GDIPlus_GraphicsDrawStringEx ($hGraphic, @HOUR&":"&@MIN&":"&@SEC, $hFont, $tLayout, $hFormat, $hBrush)
AdlibEnable("_Update",1000)
[/autoit] [autoit][/autoit] [autoit]While 1
$msg=GUIGetMsg()
Switch $msg
Case $GUI_EVENT_PRIMARYDOWN
$pos3=WinGetPos("Uhr")
$hGDIBitmap = _ScreenCapture_Capture("",$pos3[0],$pos3[1],$GUIBreite+$pos3[0],$GUIHoehe+$pos3[1])
$hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hGDIBitmap)
_WinAPI_DeleteObject($hGDIBitmap)
$pImageAttributes = _GDIPlus_ImageAttributesCreate()
_DrawImage($hGraphic, $hBitmap, 0, 0, $pImageAttributes)
_GDIPlus_ImageAttributesDispose($pImageAttributes)
EndSwitch
$pos=WinGetPos("Uhr")
$pos2=WinGetPos("Uhr")
If $pos[0] = $pos2[0] And $pos[1] = $pos2[1] Then
_WinAPI_SetLayeredWindowAttributes($hGui, 0x000000, 255,0x02)
EndIf
Sleep ( 200 )
WEnd
Func _WinAPI_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $dwFlages = 0x03, $isColorRef = False)
; progandy
If $dwFlages = Default Or $dwFlages = "" Or $dwFlages < 0 Then $dwFlages = 0x03
If Not $isColorRef Then
$i_transcolor = Hex(String($i_transcolor), 6)
$i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2))
EndIf
Local $Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hwnd, "long", $i_transcolor, "byte", $Transparency, "long", $dwFlages)
Select
Case @error
Return SetError(@error, 0, 0)
Case $Ret[0] = 0
Return SetError(4, _WinAPI_GetLastError(), 0)
Case Else
Return 1
EndSelect
EndFunc ;==>_WinAPI_SetLayeredWindowAttributes
Func MY_WM_MOVE()
_WinAPI_SetLayeredWindowAttributes($hGui, 0x000000, 0,0x01)
EndFunc
Func _Update()
;~ _GDIPlus_GraphicsClear($hGraphic,0xFF000000)
_GDIPlus_GraphicsDrawStringEx ($hGraphic, @HOUR&":"&@MIN&":"&@SEC, $hFont, $tLayout, $hFormat, $hBrush)
EndFunc
Func _CleanEnd()
_GDIPlus_FontDispose ($hFont)
_GDIPlus_FontFamilyDispose ($hFamily)
_GDIPlus_StringFormatDispose ($hFormat)
_GDIPlus_BrushDispose ($hBrush)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_Shutdown ()
Exit
EndFunc
Func _GuiRoundCorners($hWnd, $x1, $y1, $x3, $y3)
Local $pos, $ret, $ret2
$pos = WinGetPos($hWnd)
$ret = DllCall('gdi32.dll', 'long', 'CreateRoundRectRgn', 'long', $x1, 'long', $y1, 'long', $pos[2], 'long', $pos[3], 'long', $x3, 'long', $y3)
If $ret[0] Then
$ret2 = DllCall('user32.dll', 'long', 'SetWindowRgn', 'hwnd', $hWnd, 'long', $ret[0], 'int', 1)
If $ret2[0] Then
Return 1
Else
Return 0
EndIf
Else
Return 0
EndIf
EndFunc
Func _DrawImage($hGraphics, $hImage, $X, $Y, $pImageAttributes)
; Prog@ndy
Local $H = _GDIPlus_ImageGetHeight($hImage)
Local $W = _GDIPlus_ImageGetWidth($hImage)
Local $Result = _GDIPlus_GraphicsDrawImageRectRectAttr($hGraphics, $hImage, 0, 0, $W, $H, $X, $Y, $W, $H, 2, $pImageAttributes)
Return SetError(@error,0,$Result)
EndFunc
Func _GDIPlus_GraphicsDrawImageRectRectAttr($hGraphics, $hImage, $iSrcX, $iSrcY, $iSrcWidth, $iSrcHeight, $iDstX, $iDstY, $iDstWidth, $iDstHeight, $iUnit = 2, $pImageAttributes=0)
Local $aResult
$aResult = DllCall($ghGDIPDll, "int", "GdipDrawImageRectRectI", "ptr", $hGraphics, "ptr", $hImage, "int", $iDstX, "int", _
$iDstY, "int", $iDstWidth, "int", $iDstHeight, "int", $iSrcX, "int", $iSrcY, "int", $iSrcWidth, "int", _
$iSrcHeight, "int", $iUnit, "ptr", $pImageAttributes, "ptr", 0, "ptr", 0)
If @error Then Return SetError(@error, @extended, False)
Return SetError($aResult[0], 0, $aResult[0] = 0)
EndFunc ;==>_GDIPlus_GraphicsDrawImageRectRectAttr
Func _GDIPlus_ImageAttributesCreate()
; Prog@ndy
Local $aResult = DllCall($ghGDIpDLL, "int", "GdipCreateImageAttributes", "ptr*", 0)
If @error Then Return SetError(1,@error,0)
Return SetError($aResult[0],0,$aResult[1])
EndFunc
Func _GDIPlus_ImageAttributesDispose($pImageAttributes)
; Prog@ndy
Local $aResult = DllCall($ghGDIpDLL, "int", "GdipDisposeImageAttributes", "ptr", $pImageAttributes)
If @error Then Return SetError(1,@error,0)
Return SetError($aResult[0],0,$aResult[0]=0)
EndFunc
Und bei dem 2 weis ich auch nicht wie man die Zeit übermalen soll ohne dabei das Bild wieder zulöschen.