| | |
|
|
| #include <GUIConstantsEx.au3> |
|
|
| #include <WindowsConstants.au3> |
|
|
| #include <GDIPlus.au3> |
|
|
| #include <WinAPI.au3> |
|
|
| #include <GDIpProgress.au3> |
|
|
| #include <IE.au3> |
|
|
| #include <Misc.au3> |
|
|
| #include <GuiButton.au3> |
|
|
| |
|
|
| Global $hGUI, $hImage, $hGraphic, $hImage |
|
|
| Global Const $SC_DRAGMOVE = 0xF012 |
|
|
| Global Const $IMAGE_BITMAP = 0 |
|
|
| Global Const $STM_SETIMAGE = 0x0172 |
|
|
| Global $iImagePfad = @ScriptDir & "\Bilder\", $i |
|
|
| |
|
|
| |
|
|
| _GDIPlus_Startup() |
|
|
| $hImage = _GDIPlus_ImageLoadFromFile($iImagePfad & "background.png") |
|
|
| $hHBMP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) |
|
|
| $iWidth = _GDIPlus_ImageGetWidth($hImage) |
|
|
| $iHeight = _GDIPlus_ImageGetHeight($hImage) |
|
|
| |
|
|
| $hImage_Button = _GDIPlus_ImageLoadFromFile($iImagePfad & "start_0.jpg") |
|
|
| $hHBMP_Button = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage_Button) |
|
|
| |
|
|
| $oIE = _IECreateEmbedded() |
|
|
| |
|
|
| ; Create GUI |
|
|
| $hGUI = GUICreate("Test", $iWidth, $iHeight, -5000, -5000, $WS_POPUP, $WS_EX_LAYERED + $WS_EX_TOPMOST) |
|
|
| $hGUI_child = GUICreate("", $iWidth, $iHeight, -5000, -5000, $WS_POPUP, $WS_EX_LAYERED + $WS_EX_TOPMOST + $WS_EX_MDICHILD, $hGUI) |
|
|
| GUISetBkColor(0, $hGUI_child) |
|
|
| |
|
|
| $idBackgroundPic = GUICtrlCreatePic("", 0, 0, $iWidth, $iHeight) |
|
|
| GUICtrlSetState(-1, $GUI_DISABLE) |
|
|
| |
|
|
| GUISetState(@SW_SHOW, $hGUI) |
|
|
| GUISetState(@SW_SHOW, $hGUI_child) |
|
|
| SetTransparentBitmap($hGUI, $hImage) |
|
|
| _WinAPI_SetLayeredWindowAttributes($hGUI_child, 0x00, 0xff) |
|
|
| |
|
|
| _WinAPI_DeleteObject(GUICtrlSendMsg($idBackgroundPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBMP)) |
|
|
| |
|
|
| $iButton1 = GUICtrlCreateButton("hallo", 50, 50, 134, 33,$BS_BITMAP) |
|
|
| $iButton2 = _GuiCtrlCreatePic($hGUI_child, $iImagePfad & "\start_1.jpg", 100, 100) |
|
|
| $iButton = _CreateButton ($hGUI,$iImagePfad & "start_1.png",$iImagePfad & "start_2.png",100,300) |
|
|
| ;~ $iButton3 = _GuiCtrlCreatePic($hGUI, $iImagePfad & "\start_0.jpg", 200, 100) |
|
|
| ;~ GUICtrlCreatePic ($iImagePfad & "\start_1.jpg",50,50,143,33) |
|
|
| |
|
|
| ;~ GUICtrlCreateObj ($oIE,50,50,100,100) |
|
|
| ;~ _IENavigate($oIE, 'http://google.de') |
|
|
| |
|
|
| GUIRegisterMsg($WM_LBUTTONDOWN, "_WM_LBUTTONDOWN") |
|
|
| |
|
|
| WinMove($hGUI, "", (@DesktopWidth / 2) - ($iWidth / 2), (@DesktopHeight / 2) - ($iHeight / 2)) |
|
|
| WinMove($hGUI_child, "", (@DesktopWidth / 2) - ($iWidth / 2), (@DesktopHeight / 2) - ($iHeight / 2)) |
|
|
| |
|
|
| $isHover = False |
|
|
| $mem = True |
|
|
| |
|
|
| While 1 |
|
|
| $nMsg = GUIGetMsg() |
|
|
| Switch $nMsg |
|
|
| Case $GUI_EVENT_CLOSE |
|
|
| ExitLoop |
|
|
| Case $iButton2[1] |
|
|
| _WinAPI_DeleteObject(GUICtrlSendMsg($iButton2[1], $BM_SETIMAGE, $IMAGE_BITMAP, $hHBMP_Button)) |
|
|
| _WinAPI_DeleteObject(GUICtrlSendMsg($iButton1, $BM_SETIMAGE, $IMAGE_BITMAP, $hHBMP_Button)) |
|
|
| EndSwitch |
|
|
| |
|
|
| If _ButtonHover($hGUI_child, $iButton2) Then |
|
|
| _WinAPI_DeleteObject(GUICtrlSendMsg($iButton2[1], $BM_SETIMAGE, $IMAGE_BITMAP, $hHBMP_Button)) |
|
|
| EndIf |
|
|
| |
|
|
| $aCoord = GUIGetCursorInfo($hGUI) |
|
|
| If $aCoord[4] = $iButton[1] Then |
|
|
| If Not $isHover Then |
|
|
| GUICtrlSendMsg($iButton[1], $STM_SETIMAGE, $IMAGE_BITMAP, $iButton[2]) |
|
|
| $isHover = True |
|
|
| $mem = True |
|
|
| EndIf |
|
|
| Else |
|
|
| If $mem Then |
|
|
| GUICtrlSendMsg($iButton[1], $STM_SETIMAGE, $IMAGE_BITMAP, $iButton[3]) |
|
|
| $mem = False |
|
|
| $isHover = False |
|
|
| EndIf |
|
|
| EndIf |
|
|
| WEnd |
|
|
| |
|
|
| |
|
|
| ; Clean up resources |
|
|
| _GDIPlus_GraphicsDispose($hGraphic) |
|
|
| _GDIPlus_Shutdown() |
|
|
| Exit |
|
|
| |
|
|
| ; Draw PNG image |
|
|
| Func MY_WM_PAINT($hWnd, $Msg, $wParam, $lParam) |
|
|
| _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 0, 0) |
|
|
| _WinAPI_RedrawWindow($hGUI, 0, 0, 1) |
|
|
| Return $GUI_RUNDEFMSG |
|
|
| EndFunc ;==>MY_WM_PAINT |
|
|
| |
|
|
| Func _WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam) |
|
|
| _SendMessage($hGUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) |
|
|
| EndFunc ;==>_WM_LBUTTONDOWN |
|
|
| |
|
|
| Func SetTransparentBitmap($hGUI, $hImage, $iOpacity = 0xFF) |
|
|
| Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend |
|
|
| $hScrDC = _WinAPI_GetDC(0) |
|
|
| $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) |
|
|
| $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) |
|
|
| $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap) |
|
|
| $tSize = DllStructCreate($tagSIZE) |
|
|
| $pSize = DllStructGetPtr($tSize) |
|
|
| DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage)) |
|
|
| DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage)) |
|
|
| $tSource = DllStructCreate($tagPOINT) |
|
|
| $pSource = DllStructGetPtr($tSource) |
|
|
| $tBlend = DllStructCreate($tagBLENDFUNCTION) |
|
|
| $pBlend = DllStructGetPtr($tBlend) |
|
|
| DllStructSetData($tBlend, "Alpha", $iOpacity) |
|
|
| DllStructSetData($tBlend, "Format", 1) |
|
|
| _WinAPI_UpdateLayeredWindow($hGUI, 0, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA) |
|
|
| _WinAPI_ReleaseDC(0, $hScrDC) |
|
|
| _WinAPI_SelectObject($hMemDC, $hOld) |
|
|
| _WinAPI_DeleteObject($hBitmap) |
|
|
| _WinAPI_DeleteDC($hMemDC) |
|
|
| EndFunc ;==>SetTransparentBitmap |
|
|
| |
|
|
| Func _CreateButton ($gGui,$iPicture1, $iPicture2, $iX, $iY) |
|
|
| $bImage_Pic1 = _GDIPlus_ImageLoadFromFile($iPicture1) |
|
|
| $bImage_Pic2 = _GDIPlus_ImageLoadFromFile($iPicture2) |
|
|
| |
|
|
| $bHBMP_Pic1 = _GDIPlus_BitmapCreateHBITMAPFromBitmap($bImage_Pic1) |
|
|
| $bHBMP_Pic2 = _GDIPlus_BitmapCreateHBITMAPFromBitmap($bImage_Pic2) |
|
|
| |
|
|
| $bWidth = _GDIPlus_ImageGetWidth($bImage_Pic1) |
|
|
| $bHeight = _GDIPlus_ImageGetHeight($bImage_Pic1) |
|
|
| |
|
|
| $iGui = GUICreate("", $bWidth, $bHeight, $iX, $iY, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $gGui) |
|
|
| $bPicture = GUICtrlCreatePic("",$iX,$iY,$bWidth,$bHeight) |
|
|
| |
|
|
| Local $bReturn[5] = [3,$iGui,$bHBMP_Pic1,$bHBMP_Pic2] |
|
|
| Return $bReturn |
|
|
| EndFunc |
|
|
| |
|
|
| Func _GuiCtrlCreatePic($gGui, $iPicture, $iX = 0, $iY = 0) |
|
|
| $gImage = _GDIPlus_ImageLoadFromFile($iPicture) |
|
|
| $gWidth = _GDIPlus_ImageGetWidth($gImage) |
|
|
| $gHeight = _GDIPlus_ImageGetHeight($gImage) |
|
|
| |
|
|
| $iGui = GUICreate("", $gWidth, $gHeight, $iX, $iY, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $gGui) |
|
|
| $iLabel = GUICtrlCreateLabel("", 0, 0, $gWidth, $gHeight) |
|
|
| GUISetBkColor(0, $iGui) |
|
|
| GUISetState(@SW_SHOW, $iGui) |
|
|
| SetTransparentBitmap($iGui, $gImage) |
|
|
| |
|
|
| Local $iReturn[6] = [0, SetError(0, $iGui, $iLabel), $iX, $iY, $gWidth, $gHeight] |
|
|
| |
|
|
| Return $iReturn |
|
|
| EndFunc ;==>_GuiCtrlCreatePic |
|
|
| |
|
|
| Func _ButtonHover($iGui, $iButton) |
|
|
| $iMouse = GUIGetCursorInfo($iGui) |
|
|
| If ($iMouse[0] >= $iButton[2]) And _ |
|
|
| ($iMouse[0] <= $iButton[2] + $iButton[4]) And _ |
|
|
| ($iMouse[1] >= $iButton[3]) And _ |
|
|
| ($iMouse[1] <= $iButton[3] + $iButton[5]) Then ; Button hover |
|
|
| If (_IsPressed("01")) Then |
|
|
| Return 2 |
|
|
| Else |
|
|
| Return 1 |
|
|
| EndIf |
|
|
| Else |
|
|
| Return False |
|
|
| EndIf |
|
|
| EndFunc ;==>_ButtonHover |
| | |