Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 19:38

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Invisible GUI with image

Discussion on Invisible GUI with image within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Jun 2013
Posts: 11
Received Thanks: 0
Invisible GUI with image

Hi how can i make an invisible form(no windows) and see only the image?
MartaLaMarta is offline  
Old 06/13/2014, 21:56   #2
 
alpines's Avatar
 
elite*gold: 60
Join Date: Aug 2009
Posts: 2,256
Received Thanks: 815
This GUI has no borders, simply insert a picture control, resize everything and go.
Code:
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 438, 192, 146, BitOR($WS_MINIMIZEBOX,$WS_POPUP,$WS_GROUP))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit

	EndSwitch
WEnd
alpines is offline  
Old 06/14/2014, 16:18   #3
 
elite*gold: 15
Join Date: Aug 2012
Posts: 3,041
Received Thanks: 6,397
UDF:
Code:
#include-once
; #INDEX# =======================================================================================================================
; Title .........: _GUICreateAlfa.au3
; AutoIt Version : 3.3.0.0++
; Language ......: English
; Description ...: Create an alpha blended form.
; Author(s) .....: João Carlos (jscript FROM Brazil) - DVI-Informática™ 2008.6-2012.2, 
; Credits .......: Based on the Paul Campbell (PaulIA) demo.
; ===============================================================================================================================

; #INCLUDES# ====================================================================================================================
#include <GDIPlus.au3>
#include <WinAPI.au3>
;================================================================================================================================

; #VARIABLES# ===================================================================================================================
;================================================================================================================================

; #CURRENT# =====================================================================================================================
; _GUICreateAlfa
; ===============================================================================================================================

; #INTERNAL_USE_ONLY#============================================================================================================
; __WM_NCHITTEST
;================================================================================================================================

; #FUNCTION# ====================================================================================================================
; Name ..........: _GUICreateAlfa
; Description ...: Create an alpha blended form.
; Syntax ........: _GUICreateAlfa( Title, Image[, Width [, Height [, Left [, Top ]]]])
; Parameters ....: $sTitle				- The title of the dialog box.
;				   $sImage              - Filename of the picture to be loaded : supported types BMP, JPG, GIF(but not animated).
;                  $iWidth              - [optional] The width of the window. Default is image width.
;                  $iHeight             - [optional] The height of the window. Default is image height.
;                  $iLeft               - [optional] The left side of the dialog box. Default is -1 (the window is centered).
;										If defined, $iTop must also be defined.
;                  $iTop                - [optional] The top of the dialog box. Default is -1 (centered).
; Return values .: None
; Author ........: João Carlos (jscript FROM Brazil)
; Modified ......:
; Remarks .......: Based on the "Shows how to create an alpha blended form" by Paul Campbell (PaulIA)
; Related .......:
; Link ..........:
; Example .......: _GUICreateAlfa(@ScriptDir & "\GUILayered.png")
; ===============================================================================================================================
Func _GUICreateAlfa($sTitle, $sImage, $iWidth = -1, $iHeight = -1, $iLeft = -1, $iTop = -1, $lMove = True)
	Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend
	Local $hWnd = 0, $hForm = 0, $hImage, $iError = 0

	If Not FileExists($sImage) Then Return SetError(1, 0, 0)

	;----> Initialize GDI+ library only if not alread started!
	If $ghGDIPDll = 0 Then _GDIPlus_Startup()
	;<----

	;----> Load layered image
	$hImage = _GDIPlus_ImageLoadFromFile($sImage)
	Select
		Case $hImage > 0
			If $iWidth = -1 Then $iWidth = _GDIPlus_ImageGetWidth($hImage)
			If $iHeight = -1 Then $iHeight = _GDIPlus_ImageGetHeight($hImage)
			;<----

			;----> Create an layered window.
			$hWnd = GUICreate($sTitle, $iWidth, $iHeight, $iLeft, $iTop, $WS_POPUP, $WS_EX_LAYERED)
			;<----

			;----> Set Bitmap image into GUI.
			$hScrDC = _WinAPI_GetDC(0)
			$hMemDC = _WinAPI_CreateCompatibleDC($hScrDC)
			$hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
			$hOld = _WinAPI_SelectObject($hMemDC, $hBitmap)
			;-- Create structures.
			$tSize = DllStructCreate($tagSIZE)
			$pSize = DllStructGetPtr($tSize)
			DllStructSetData($tSize, "X", $iWidth)
			DllStructSetData($tSize, "Y", $iHeight)
			$tSource = DllStructCreate($tagPOINT)
			$pSource = DllStructGetPtr($tSource)
			$tBlend = DllStructCreate($tagBLENDFUNCTION)
			$pBlend = DllStructGetPtr($tBlend)
			DllStructSetData($tBlend, "Alpha", 255) ; 255 => Opacity
			DllStructSetData($tBlend, "Format", 1) ; 1 => $AC_SRC_ALPHA
			_WinAPI_UpdateLayeredWindow($hWnd, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA)
			;-- Release resources.
			_WinAPI_ReleaseDC(0, $hScrDC)
			_WinAPI_SelectObject($hMemDC, $hOld)
			_WinAPI_DeleteObject($hBitmap)
			_WinAPI_DeleteDC($hMemDC)
			_GDIPlus_ImageDispose($hImage)
			;<----

			;----> Register notification messages.
			If $lMove Then GUIRegisterMsg($WM_NCHITTEST, "__WM_NCHITTEST")
			;<----
			GUISetState(@SW_SHOW, $hWnd)
			;----> Gui for controls...
			$hForm = GUICreate("ControlGUI", $iWidth, $iHeight, $iLeft, $iTop, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $hWnd)
			GUISetBkColor(0xABABAB); For transparency!
			Switch @OSVersion
				Case "WIN_2000", "WIN_XP", "WIN_XPe", "WIN_2003"
					_WinAPI_SetLayeredWindowAttributes($hForm, 0xABABAB, 255, $LWA_COLORKEY);BitOR($LWA_COLORKEY, $LWA_ALPHA))
				Case Else
					_WinAPI_SetLayeredWindowAttributes($hForm, 0xABABAB, 255, BitOR($LWA_COLORKEY, $LWA_ALPHA))
			EndSwitch
			;<----
		Case Else
			$iError = 1
	EndSelect
	;----> Clean up resources used by Microsoft Windows GDI+.
	_GDIPlus_Shutdown()
	;<----
	Return SetError($iError, 0, $hWnd)
EndFunc   ;==>_GUICreateAlfa

; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name ..........: __WM_NCHITTEST
; Description ...: For the layered window, so it can be dragged by clicking anywhere on the image.
; Syntax ........: __WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam)
; Parameters ....: $hWnd                - A handle value.
;                  $iMsg                - An integer value.
;                  $iwParam             - An integer value.
;                  $ilParam             - An integer value.
; Return values .: None
; Author ........: João Carlos (jscript FROM Brazil)
; Modified ......:
; Remarks .......: Based on the "Shows how to create an alpha blended form" by Paul Campbell (PaulIA)
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func __WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam)
	#forceref $hWnd, $iMsg, $iwParam, $ilParam
	If $iMsg = $WM_NCHITTEST Then Return $HTCAPTION
EndFunc   ;==>__WM_NCHITTEST
Example:
Code:
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

#include "_GUICreateAlfa.au3"

$hWnd = _GUICreateAlfa("Alpha Blend GUI", StringReplace(@AutoItExe & "\Examples\GUI\Torus.png", "\autoit3.exe", ""))

$iBtn_Min = GUICtrlCreateButton("_", 10, 20, 22)
GUICtrlSetTip(-1, "Minimize")
$iBtn_Close = GUICtrlCreateButton("[X]", 32, 20)
GUICtrlSetTip(-1, "Close")

GUICtrlCreateLabel("This is an example of text...", 0, 60, 200, 50)
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetFont(-1, 15, 400, 0)

GUISetState(@SW_SHOW)

While 1
	Switch GUIGetMsg()
		Case $GUI_EVENT_CLOSE, $iBtn_Close
			Exit
		Case $iBtn_Min
			GUISetState(@SW_MINIMIZE, $hWnd)
	EndSwitch
WEnd
berkay2578 is offline  
Reply


Similar Threads Similar Threads
Lawl Image - Easy Image upload
10/08/2015 - Coding Releases - 132 Replies
Hier steht euch nun die gründlich überarbeitete Version von LawlImage zur verfügung! Mit LawlImage ist es einfach wie nie, schnell Bilder hochzuladen. Das einzige was ihr tun müsst, ist einen Rechtsklick auf das Bild auszuführen und unter "Senden an" oder "Send To" LawlImage zu wählen. Schneller kann man Bilder nicht hochladen! http://image.lawl-dev.com/imgsrv.php?url=79348bed 8d5da002ffc10d36f2e916d2.png
[Trading] Signature image + topic image
07/31/2013 - League of Legends Trading - 0 Replies
If you can make those please add me on my skype, which can be found in my signature.
Dibiase - New Sig/Full Size Image - [GIANT IMAGE WARNING]
10/26/2011 - General Art - 1 Replies
WARNING - SOME OF THESE IMAGES ARE MASSIVE(OVER 2000 PIXELS WIDE/1000 PIXELS HIGH). This is my latest signature collection, the full size images show the detail. Full-Size: http://img339.imageshack.us/img339/971/dibiaseful l.png Super-Sized:



All times are GMT +1. The time now is 19:39.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.