Hallo Liebes Forum,
Ich habe ein Script am laufen , und habe jetzt mal schnell ein neues erstellt
Ich wollte mein GUI an einem Png Bildchen verschieben und die Position speichern.
Leider weiß ich nicht wie ich das machen könnte , die Sufu spuckt auch nur doofe sachen aus.
Hier erstmal das Script (Das Bild ist im Anhang)
Spoiler anzeigen
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <INet.au3>
#include <string.au3>
#include <GDIPlus.au3>
#include <Misc.au3>
#Include <WinAPI.au3>
#include <ListViewConstants.au3>
#Include <Array.au3>
#Include <File.au3>
#Include <GuiListView.au3>
_GDIPlus_Startup()
$Trans = 205
$Color = 0x545454
$hGui = GUICreate("Desktop Wetter", 160, 245, 0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED,$WS_EX_TOOLWINDOW))
$Menu = GUICtrlCreateContextMenu()
$mSettings = GUICtrlCreateMenuItem("Einstellungen...", $Menu)
$mExit = GUICtrlCreateMenuItem("Beenden...", $Menu)
GUICtrlCreateMenuItem("", $Menu)
$About = GUICtrlCreateMenuItem("Über Uns...", $Menu)
GUISetBkColor($Color, $hGui)
$MOVE = GUICtrlCreatePic("",1,1,0,0)
[/autoit] [autoit][/autoit] [autoit]WinSetTrans($hGui, "", $Trans)
GUISetState(@SW_SHOW)
_Bild()
While 1
$msg = GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func _Bild()
$Image = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\" & "Maps.png")
$hImage = _GDIPlus_BitmapCreateHBITMAPFromBitmap($Image)
_SetBitmapToCtrl($MOVE ,$hImage)
EndFunc
Func _SetBitmapToCtrl($CtrlId, $hBitmap)
Local Const $STM_SETIMAGE = 0x0172
Local Const $STM_GETIMAGE = 0x0173
Local Const $BM_SETIMAGE = 0xF7
Local Const $BM_GETIMAGE = 0xF6
Local Const $IMAGE_BITMAP = 0
Local Const $SS_BITMAP = 0x0E
Local Const $BS_BITMAP = 0x0080
Local Const $GWL_STYLE = -16
Local $hWnd, $hPrev, $Style, $iCtrl_SETIMAGE, $iCtrl_GETIMAGE, $iCtrl_BITMAP
[/autoit] [autoit][/autoit] [autoit]; determine control class and adjust constants accordingly
Switch _WinAPI_GetClassName($CtrlId)
Case "Button" ; button,checkbox,radiobutton,groupbox
$iCtrl_SETIMAGE = $BM_SETIMAGE
$iCtrl_GETIMAGE = $BM_GETIMAGE
$iCtrl_BITMAP = $BS_BITMAP
Case "Static" ; picture,icon,label
$iCtrl_SETIMAGE = $STM_SETIMAGE
$iCtrl_GETIMAGE = $STM_GETIMAGE
$iCtrl_BITMAP = $SS_BITMAP
Case Else
Return SetError(1, 0, 0)
EndSwitch
$hWnd = GUICtrlGetHandle($CtrlId)
If $hWnd = 0 Then Return SetError(2, 0, 0)
; set SS_BITMAP/BS_BITMAP style to the control
$Style = _WinAPI_GetWindowLong($hWnd, $GWL_STYLE)
If @error Then Return SetError(3, 0, 0)
_WinAPI_SetWindowLong($hWnd, $GWL_STYLE, BitOR($Style, $iCtrl_BITMAP))
If @error Then Return SetError(4, 0, 0)
; set image to the control
$hPrev = _SendMessage($hWnd, $iCtrl_SETIMAGE, $IMAGE_BITMAP, $hBitmap)
If @error Then Return SetError(5, 0, 0)
If $hPrev Then _WinAPI_DeleteObject($hPrev)
Return 1
EndFunc