Kore Posted September 18, 2013 Share Posted September 18, 2013 How do I display a png image in a specific x / y location without a GUI background to it? Link to comment Share on other sites More sharing options...
FireFox Posted September 18, 2013 Share Posted September 18, 2013 Hi,There are plenty of examples in the forum, search for these keywords "layered png".Br, FireFox. Kore 1 Link to comment Share on other sites More sharing options...
Kore Posted September 18, 2013 Author Share Posted September 18, 2013 (edited) Hi, There are plenty of examples in the forum, search for these keywords "layered png". Br, FireFox. expandcollapse popup#include <GDIPlus.au3> #include <WindowsConstants.au3> #include <GuiConstantsEx.au3> #include <StaticConstants.au3> Global Const $AC_SRC_ALPHA = 1 Opt("GUIOnEventMode", 1) _GDIPlus_Startup() $pngSrc = @ScriptDir & "\line.png" GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") $GUI = _GUICreate_Alpha("Look at the shiny", $pngSrc) GUISetState() GUICtrlSetState(1, $GUI_ONTOP) While 1 Sleep(100) WEnd Func _GUICreate_Alpha($sTitle, $sPath, $iX=276, $iY=780, $iOpacity=255) Local $hGUI, $hImage, $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend $hImage = _GDIPlus_ImageLoadFromFile($sPath) $width = _GDIPlus_ImageGetWidth($hImage) $height = _GDIPlus_ImageGetHeight($hImage) $hGUI = GUICreate($sTitle, $width, $height, $iX, $iY, $WS_POPUP, $WS_EX_LAYERED) $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", $width) DllStructSetData($tSize, "Y", $height) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha", $iOpacity) DllStructSetData($tBlend, "Format", 1) _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, 2) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteObject($hImage) _WinAPI_DeleteDC($hMemDC) EndFunc ;==>_GUICreate_Alpha Is there a way to make $GUI = _GUICreate_Alpha("Look at the shiny", $pngSrc) - not show up in the taskbar? Also is it possible to have this always on top of windows? I tried: GUICtrlSetState(1, $GUI_ONTOP) Edited September 18, 2013 by Kore Link to comment Share on other sites More sharing options...
FireFox Posted September 18, 2013 Share Posted September 18, 2013 Sure, add TOPMOST and TOOLWINDOW exstyles.GUICtrlSetState, like its name is made for GUI controls, not the GUI itself.Br, FireFox. Kore 1 Link to comment Share on other sites More sharing options...
Kore Posted September 18, 2013 Author Share Posted September 18, 2013 Sure, add TOPMOST and TOOLWINDOW exstyles. GUICtrlSetState, like its name is made for GUI controls, not the GUI itself. Br, FireFox. Do i add that to the Func _GUICreate_Alpha? Link to comment Share on other sites More sharing options...
FireFox Posted September 18, 2013 Share Posted September 18, 2013 GUI exstyles. Take a look at the GUICreate function in the helpfile to understand what I mean.Br, FireFox. Link to comment Share on other sites More sharing options...
Kore Posted September 18, 2013 Author Share Posted September 18, 2013 Oh nm, $hGUI = GUICreate($sTitle, $width, $height, $iX, $iY, $WS_POPUP, $WS_EX_LAYERED) Link to comment Share on other sites More sharing options...
Kore Posted September 18, 2013 Author Share Posted September 18, 2013 Thx got it working BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST) Link to comment Share on other sites More sharing options...
FireFox Posted September 18, 2013 Share Posted September 18, 2013 (edited) and ... $WS_EX_TOOLWINDOW Edited September 18, 2013 by FireFox Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now