Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/05/2013 in all areas

  1. Here one way to do it: #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <GDIPlus.au3> Opt("GUICoordMode", 1) _GDIPlus_Startup() Global Const $hBgImage = _GDIPlus_ImageLoadFromFile(StringReplace(@AutoItExe, "autoit3.exe", "Examples\GUI\msoobe.jpg")) Global Const $iW = _GDIPlus_ImageGetWidth($hBgImage) Global Const $iH = _GDIPlus_ImageGetHeight($hBgImage) Global Const $hGUI = GUICreate("GDI+ Test", $iW, $iH) Global Const $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) Global Const $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hGraphic) Global Const $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap) Global Const $hFgImage = _GDIPlus_ImageLoadFromFile(StringReplace(@AutoItExe, "autoit3.exe", "Examples\GUI\Torus.png")) Global Const $iW_Fg = _GDIPlus_ImageGetWidth($hFgImage), $iH_Fg = _GDIPlus_ImageGetHeight($hFgImage) Global $iPosX = 0, $iPosY = 0 Global Const $hGUI_Child = GUICreate("",$iW_Fg , $iH_Fg, $iPosX, $iPosY, $WS_POPUP, $WS_EX_MDICHILD + $WS_EX_LAYERED + $WS_EX_TRANSPARENT, $hGUI) Global Const $hGraphic_Child = _GDIPlus_GraphicsCreateFromHWND($hGUI_Child) GUISetState(@SW_SHOW, $hGUI) GUISetState(@SW_SHOW, $hGUI_Child) Global Const $iYCaption = _WinAPI_GetSystemMetrics(4) Global Const $iYFixedFrame = _WinAPI_GetSystemMetrics(8) Global Const $iXFixedFrame = _WinAPI_GetSystemMetrics(7) _GDIPlus_GraphicsDrawImage($hContext, $hBgImage, 0, 0) _GDIPlus_GraphicsDrawImage($hGraphic, $hBitmap, 0, 0) SetTransparentBitmap($hGUI_Child, $hFgImage) Global $fVectorX = Random(1, 3) Global $fVectorY = Random(1, 3) AdlibRegister("MoveGUI", 20) Do Switch GUIGetMsg() Case $GUI_EVENT_CLOSE AdlibUnRegister("MoveGUI") _GDIPlus_ImageDispose($hBgImage) _GDIPlus_ImageDispose($hFgImage) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_GraphicsDispose($hContext) _GDIPlus_GraphicsDispose($hGraphic_Child) _GDIPlus_GraphicsDispose($hGraphic) GUIDelete($hGUI_Child) GUIDelete($hGUI) _GDIPlus_Shutdown() Exit EndSwitch Until False Func MoveGUI() Local $aPos = WinGetPos ($hGUI) $iPosX += $fVectorX $iPosY += $fVectorY WinMove($hGUI_Child, "", $aPos[0] + $iPosX + $iXFixedFrame, $aPos[1] + $iPosY + $iYCaption + $iYFixedFrame) If $iPosX < 0 Or ($iPosX + $iW_Fg) > $iW Then $fVectorX *= -1 If $iPosY < 0 Or ($iPosY + $iH_Fg) > $iH Then $fVectorY *= -1 EndFunc 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, $hMemDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteDC($hMemDC) EndFunc ;==>SetTransparentBitmap Br, UEZ
    1 point
  2. Define appropriate. They both give the same result so I would say it comes down to personal preference.
    1 point
  3. If your are moving your bitmap you have to clear the current GDI+ graphic handle usually. I assume in you case with another background image you have to set your background image again and move the foreground image to the new possition. There is no other way to do it if you working directly on the graphic handle. Other possibility is to create a child gui which is moving over the background. Br, UEZ
    1 point
  4. How would I go about waiting for interaction of a window on the desktop and targeting that window? I'm making a window-organizing app (which I'll share after it's complete) and want to watch for when a window is resized/moved on the desktop.
    1 point
  5. The AutoIt3 team has included many UDF's in the standard installer and are trying to support them when Bugs are detected or changes in AutoIt3 dictates updates. To report Bugs for the standard included UDFs you can use our BugTracker website and filling out a Bug report that contains all needed information.New UDF's are welcome as long as they adhere to the standards and are usefull for a larger group of scripters and time permits to get it included. Before putting any time into changing your UDF and creating the standard documentation and examples we want you first to submit the idea in the BugTracker website and filling out a Feature Request specifying your proposal. After you receive our approval the work can start to supply all required standard information as described in UDF standards page.We are currently reviewing the whole setup and will not add any new UDF until we know how we will move forward. Stay tuned.
    1 point
×
×
  • Create New...