ChrisL Posted November 23, 2007 Share Posted November 23, 2007 (edited) This works like SplashTextOn() but can also include a graphic like SplashImageOn() #include "_SplashTextWithGraphic.au3" $graphic = @Systemdir & "\oobe\images\mslogo.jpg" $text = @crlf & "This is my test text with a graphic" $var = _SplashTextWithGraphicOn("SplashText With Graphic",$text,500,400,-1,-1,$graphic,120,5,0,0,32,"",48) If $var > 0 then ConsoleWrite("_SplashTextWithGraphicOn() had error " & $var & @crlf) Sleep (5000) _SplashTextWithGraphicOFF() Edit: Changed Slash to Splash!_SplashTextWithGraphic.au3 Edited November 24, 2007 by ChrisL [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
jvanegmond Posted November 23, 2007 Share Posted November 23, 2007 Not a real Splash though, just a GUI. github.com/jvanegmond Link to comment Share on other sites More sharing options...
ChrisL Posted November 23, 2007 Author Share Posted November 23, 2007 Not a real Splash though, just a GUI.What's your point?SplashTextOn() creates a gui with a label, I had the need to create an app where someone could create a gui with a message by putting stuff in an ini file. Initially I used the standard SplashTextOn() because it allowed them to set window options and was straight forward to do it took all the values from the ini file and passed them to SplashTextOn(). Later they asked me if they could add an image to it, so I created a function which pretty much emulates SplashTextOn() but allowed you to add a picture too.You can use the same options as SplashTextOn() for ontop, text position window style as the original.I put it here in case anyone else had a need for such a function. [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
jvanegmond Posted November 24, 2007 Share Posted November 24, 2007 What's your point?SplashTextOn() creates a gui with a label, I had the need to create an app where someone could create a gui with a message by putting stuff in an ini file. Initially I used the standard SplashTextOn() because it allowed them to set window options and was straight forward to do it took all the values from the ini file and passed them to SplashTextOn(). Later they asked me if they could add an image to it, so I created a function which pretty much emulates SplashTextOn() but allowed you to add a picture too.You can use the same options as SplashTextOn() for ontop, text position window style as the original.I put it here in case anyone else had a need for such a function.SplashTextOn() (and other splash functions) do not create an AutoIt GUI with a label, although you might see it as such..It calls an object that creates the splash, and later destroys it. You're replacing the object, with a normal GUI.. so, it's not a real splash, but just a GUI. github.com/jvanegmond Link to comment Share on other sites More sharing options...
martin Posted September 11, 2008 Share Posted September 11, 2008 Because TheCats asked for a splash with coloured text, and was pointed to this thread, I made it so that text colour is a paramater, and updated the udf. CODE #cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.8.2? Author: Chris Lambert, (coloured text added by mg) Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- #include-once #include <GuiConstantsEx.au3> #include <windowsconstants.au3> #include <staticconstants.au3> ; Script Start - Add your code below here Global $Splash_Gui_Main ;=============================================================================== ; ; Function Name: _SplashTextWithGraphicOn ; Description: Creates a splash text window with graphic ; Syntax: _SplashTextWithGraphicOn($vWinTitle="",$vText="",$iWidth=500,$iHeight=400,$iXPos=-1,$iYPos=-1,$vGraphic="",$iLogo_XPos=0,$iLogo_YPos=0,$iLogo_Width=0,$iLogo_Height=0,$iOpt = 0,$vFontName = "",$iFontSz = 12,$iFontWt = 400) ; Call _splashTextWithGraphicOFF() to turn off splash window ; ; Parameter(s): $vWinTitle (Optional) = Title for splash window. ; $vText (Optional) = Text for splash window. ; $iWidth (Optional) = Width of window in pixels. (default 500) ; $iHeight (Optional) = Height of window in pixels. (default 400) ; $iXPos (Optional) = Position from left (in pixels) of splash window. (default is centered) ; $iYPos (Optional) = Position from top (in pixels) of splash window. (default is centered) ; $vGraphic (Optional) = Graphic to use in Splash window. ; $iLogo_XPos (Optional) = Left position of top left corner of the graphic inside the splash window ; $iLogo_YPos (Optional) = Top position of top left corner of the graphic inside the splash window ; $iLogo_Width (Optional) = Width to display the graphic ; $iLogo_Height (Optional) = Height to display the graphic ; $iOpt (Optional) = Option see list below ; [optional] Add them up - default is 'center justified/always on top/with title' ; 0 = Center justified/always on top/with title (default) ; 1 = Thin bordered titleless window ; 2 = Without "always on top" attribute ; 4 = Left justified text ; 8 = Right justified text ; 16 = Windows can be moved ; 32 = Centered vertically text ; $vFontName (Optional) = Font to use. (OS default GUI font is used if the font is "" or is not found) ; $iFontSz (Optional) = Font size. (default is 12; standard sizes are 6 8 9 10 11 12 14 16 18 20 22 24 26 28 36 48 72) ; $iFontWt (Optional) = Font weight (0 - 1000, default = 400 = normal). A value > 1000 is treated as zero. ; ; Requirement(s): None ; ; Return Value(s): On Success - Returns 0 ; On Failure - Returns an Error code based on the first error from left to right of syntax ; Window handle is stored in $Splash_Gui_Main ; error Codes ;0 No Error ;1 GuiWidth is not numeric ;2 GuiHeight is not numeric ;3 GuiXpos is not numeric ;4 GuiYpos is not numeric ;5 Graphic does not exist ;6 GraphicXpos is not numeric ;7 GraphicYpos is not numeric ;8 GraphicWidth is not numeric ;9 GraphicHeight is not numeric ;10 Font size is not numeric ;11 Font Weight is not numeric ;12 Font Weight is greater than 1000 ;13 Font Weight is less than 0 ; Author(s): Chris Lambert (ChrisL) (WM_NCHITTEST() and _API_DefWindowProc() was found on a post by Martin on Autoit Forms!) ; Note(s): Based on SplashTextOn() and SplashImageOn() ;=============================================================================== Func _SplashTextWithGraphicOn($vWinTitle="",$vText="",$iWidth=500,$iHeight=400,$iXPos=-1,$iYPos=-1,$vGraphic="",$iLogo_XPos=0,$iLogo_YPos=0,$iLogo_Width=0,$iLogo_Height=0,$iOpt = 0,$vFontName = "",$iFontSz = 12,$iFontWt = 400,$iFontCol = 0) DIM Const $WM_ENTERSIZEMOVE = 0x231 DIM Const $WM_EXITSIZEMOVE = 0x232 ;DIM Const $WM_NCHITTEST = 0x0084 Local $Ret = 0 If $iFontWt < 0 then $iFontWt = 0 $Ret = 13 EndIf If $iFontWt > 1000 then $iFontWt = 1000 $Ret = 12 EndIf If NOT Int($iFontWt) then $iFontWt=400 $Ret = 11 EndIf If NOT Int($iFontSz) then $iFontSz=12 $Ret = 10 EndIf If NOT StringIsDigit($iLogo_Height) then $iLogo_Height = 0 $Ret = 9 EndIf If NOT StringIsDigit($iLogo_Width) then $iLogo_Width = 0 $Ret = 8 Endif If NOT Int($iLogo_YPos) then $iLogo_YPos=0 $Ret = 7 EndIf If NOT Int($iLogo_XPos) then $iLogo_XPos=0 $Ret = 6 Endif If $vGraphic <> "" then If NOT FileExists($vGraphic) then $Ret = 5 EndIf If NOT Int($iYPos) then $iYPos=-1 $Ret = 4 EndIf If NOT Int($iXpos) then $iXPos=-1 $Ret = 3 Endif If NOT Int($iHeight) then $iHeight=400 $Ret = 2 EndIf If NOT Int($iWidth) then $iWidth=500 $Ret = 1 EndIf If BitAnd($iOpt,1) then $Splash_Gui_Main = GuiCreate($vWinTitle,$iWidth,$iHeight,$iXPos,$iYPos, BitOr ($WS_POPUP,$WS_BORDER)) Else $Splash_Gui_Main = GuiCreate($vWinTitle,$iWidth,$iHeight,$iXPos,$iYPos,BitOr($WS_CAPTION, $WS_POPUP)) EndIf If $vGraphic <> "" and FileExists($vGraphic) then $pic = GuiCtrlCreatePic($vGraphic,$iLogo_XPos,$iLogo_YPos,$iLogo_Width,$iLogo_Height) GuiCtrlSetState(-1,$GUI_DISABLE) EndIf $edit = GuiCtrlCreateLabel($vText,0,0,$iWidth,$iHeight,$SS_CENTER,$WS_EX_TRANSPARENT ) GuiCtrlSetFont(-1,$iFontSz,$iFontWt,-1,$vFontName) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetColor(-1,$iFontCol) If NOT BitAnd($iOpt,2) then WinSetOnTop($Splash_Gui_Main,"",1) EndIf If BitAnd($iOpt,4) then GUICtrlSetStyle($edit,$SS_LEFT) EndIf If BitAnd($iOpt,8) then GUICtrlSetStyle($edit,$SS_RIGHT ) EndIf If BitAnd($iOpt,32) then GUICtrlSetStyle($edit,$SS_CENTERIMAGE) EndIf GuiSetState() If NOT BitAnd($iOpt,16) then GUIRegisterMsg($WM_NCHITTEST,"WM_NCHITTEST") EndIf SetError($ret) Return $Ret EndFunc Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam) If Not IsDeclared("WM_NCHITTEST") then Local $WM_NCHITTEST ;Just to keep Au3Check happy! Return EndIf If $hWnd = $Splash_Gui_Main And $iMsg = $WM_NCHITTEST Then $id = _API_DefWindowProc($hWnd, $iMsg, $iwParam, $ilParam) If $id = 2 Then;if it is the title handle Return 1;return the client handle Else Return $id;return the real handle EndIf EndIf EndFunc Func _API_DefWindowProc($hWnd, $iMsg, $iwParam, $ilParam) Local $aResult $aResult = DllCall("User32.dll", "int", "DefWindowProc", "hwnd", $hWnd, "int", $iMsg, "int", $iwParam, "int", $ilParam) Return $aResult[0] EndFunc Func _SplashTextWithGraphicOFF() IF WinExists($Splash_Gui_Main) then GuiDelete($Splash_Gui_Main) $Splash_Gui_Main = "" EndFunc Here is the updated example #include "_SplashTextWithGraphic.au3" $graphic = @Systemdir & "\oobe\images\mslogo.jpg" $text = " text with graphic" $var = _SplashTextWithGraphicOn("SplashText With Graphic",$text,500,400,-1,-1,$graphic,120,5,0,0,32,"",48,400,0xff0000) ;_SplashTextWithGraphicOn($vWinTitle="",$vText="",$iWidth=500,$iHeight=400,$iXPos=-1,$iYPos=-1,$vGraphic="",$iLogo_XPos=0,$iLogo_YPos=0,$iLogo_Width=0,$iLogo_Height=0,$iOpt = 0,$vFontName = "",$iFontSz = 12,$iFontWt = 400,$iFontCol = 0) If $var > 0 then ConsoleWrite("_SplashTextWithGraphicOn() had error " & $var & @crlf) Sleep (5000) _SplashTextWithGraphicOFF() Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. 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