Jump to content

SpalshScreen [solved]


Recommended Posts

Hi, I want to do a little program. This program will show me a little picture in the middle of my screen.yes, I know the Splashimage command, but how can i remove the frame from it?(the X,minimize...). and if it possible can i put an Always on top attirbute? (like if any game or movie or any program is on it'll be ALWAYS on the top.

(pic attached)

Thanks!

post-57268-12767776505424_thumb.jpg

Edited by Unc3nZureD
Link to comment
Share on other sites

Here a very simple Splash Screen example I made:

#include <WindowsConstants.au3>
#include <GDIPlus.au3>
Opt('MustDeclareVars', 1)
Opt("GUIOnEventMode", 1)
Global $hWnd, $hGraphic, $file, $hImage
Global $iX, $iY

$file = "c:\Program Files\AutoIt3\Examples\GUI\logo4.gif"

If Not FileExists($file) Then Exit MsgBox(16, "Error", $file & " not found!", 10)

_GDIPlus_Startup()

$hImage = _GDIPlus_ImageLoadFromFile($file)

$iX = _GDIPlus_ImageGetWidth($hImage)
$iY = _GDIPlus_ImageGetHeight($hImage)

$hWnd = GUICreate("Simple Splash Screen by UEZ", $iX, $iY, -1, -1, $WS_BORDER + $WS_SYSMENU + $WS_POPUP, $WS_EX_TOPMOST)
WinSetTrans($hWnd, "", 0)
GUISetState()

$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd)
_GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage, 0, 0, $iX, $iY)

GUIRegisterMsg(0x000F, "WM_PAINT") ;$WM_PAINT = 0x000F
GUIRegisterMsg(0x0014 , "WM_ERASEBKGND") ;WM_ERASEBKGND = 0x0014

GUISetOnEvent(-3, "_Exit")

For $i = 0 To 255 Step 2
    WinSetTrans($hWnd, "", $i)
    Sleep(15)
Next

Sleep(5000)

For $i = 255 To 0 Step -2
    WinSetTrans($hWnd, "", $i)
    Sleep(5)
Next

GUIDelete($hWnd)

_Exit()

Func _Exit()
    GUIRegisterMsg(0x000F, "")
    GUIRegisterMsg(0x0014, "")
    _GDIPlus_ImageDispose($hImage)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()
    Exit
EndFunc

Func WM_PAINT()
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage, 0, 0, $iX, $iY)
    Return "GUI_RUNDEFMSG"
EndFunc ;==>WM_PAINT

Func WM_ERASEBKGND()
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage, 0, 0, $iX, $iY)
    Return "GUI_RUNDEFMSG"
EndFunc

BR,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Here a very simple Splash Screen example I made:

#include <WindowsConstants.au3>
#include <GDIPlus.au3>
Opt('MustDeclareVars', 1)
Opt("GUIOnEventMode", 1)
Global $hWnd, $hGraphic, $file, $hImage
Global $iX, $iY

$file = "c:\Program Files\AutoIt3\Examples\GUI\logo4.gif"

_GDIPlus_Startup()

$hImage = _GDIPlus_ImageLoadFromFile($file)

$iX = _GDIPlus_ImageGetWidth($hImage)
$iY = _GDIPlus_ImageGetHeight($hImage)

$hWnd = GUICreate("Simple Splash Screen by UEZ", $iX, $iY, -1, -1, $WS_BORDER + $WS_SYSMENU + $WS_POPUP, $WS_EX_TOPMOST)
WinSetTrans($hWnd, "", 0)
GUISetState()

$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd)
_GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage, 0, 0, $iX, $iY)

GUIRegisterMsg(0x000F, "WM_PAINT") ;$WM_PAINT = 0x000F
GUIRegisterMsg(0x0014 , "WM_ERASEBKGND") ;WM_ERASEBKGND = 0x0014

GUISetOnEvent(-3, "_Exit")

For $i = 0 To 255 Step 0.005
    WinSetTrans($hWnd, "", $i)
Next

Sleep(5000)

For $i = 255 To 0 Step -0.01
    WinSetTrans($hWnd, "", $i)
Next

GUIDelete($hWnd)

_Exit()

Func _Exit()
    GUIRegisterMsg(0x000F, "")
    GUIRegisterMsg(0x0014, "")
    _GDIPlus_ImageDispose($hImage)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()
    Exit
EndFunc

Func WM_PAINT()
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage, 0, 0, $iX, $iY)
    Return "GUI_RUNDEFMSG"
EndFunc ;==>WM_PAINT

Func WM_ERASEBKGND()
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage, 0, 0, $iX, $iY)
    Return "GUI_RUNDEFMSG"
EndFunc

BR,

UEZ

Dunno why but it won't work for me.

If i start it nothing won't happen. (i changed the way of the pic)

Link to comment
Share on other sites

Can you add this line

If Not FileExists($file) Then Exit MsgBox(16, "Error", $file & " not found!", 10)

just after

$file = "c:\Program Files\AutoIt3\Examples\GUI\logo4.gif"?

Do you get an em?

BR,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Yes, Still nothing.

Do you get the em: c:\Program Files\AutoIt3\Examples\GUI\logo4.gif not found?

If not, what is the output from SciTE when you run the script?

BR,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Same on a different image e.g. *.jpg?

BR,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

You should update AutoIt to latest version!

Yes, it is working properly on my notebook!

Can somebody confirm?

BR,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

  • Moderators

UEZ,

Works fine for me. Vista 32 SP2, AutoIt 3.3.6.1. :mellow:

M23

Edit:

If you want do it without GDI, you can find the image dimensions from the file properties like this: :P

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

HotKeySet("{ESC}", "On_Exit")
Func On_Exit()
    Exit
EndFunc

$sPicPath = "c:\Program Files\AutoIt3\Examples\GUI\logo4.gif"

$sDimensions = ""
$oShellApp = ObjCreate("shell.application")
If IsObj($oShellApp) Then
    Local $oDir = $oShellApp.NameSpace("C:\Program Files\AutoIt3\Examples\GUI")
    If IsObj($oDir) Then
        Local $oFile = $oDir.Parsename("logo4.gif")
        If IsObj($oFile) Then
            If @OSVersion = "WIN_VISTA" Or @OSVersion = "WIN_7" Then
                $sDimensions = $oDir.GetDetailsOf($oFile, 31)
            ElseIf @OSVersion = "WIN_XP" Then
                $sDimensions = $oDir.GetDetailsOf($oFile, 26)
            EndIf
        EndIf
    EndIf
EndIf
If $sDimensions = "" Then MsgBox(0, "Error", "Object creation failed")

$aDimensions = StringSplit(StringtrimLeft(StringTrimRight(StringStripWS($sDimensions,  8), 1), 1), "x")

$hGUI = GUICreate("Test", $aDimensions[1], $aDimensions[2], Default, Default, $WS_POPUP)

GUICtrlCreatePic($sPicPath, 0, 0, $aDimensions[1], $aDimensions[2])

WinSetTrans($hGUI, "", 0)

GUISetState()

For $i = 1 To 255
    Sleep(20)
    WinSetTrans($hGUI, "", $i)
Next

While 1
    Sleep(10)
WEnd

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Working fine on XP(SP3, Vista(SP2), Win 7

All 32 bit

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

I deleted the ßeta version and i'll install it again. I hope it will work! UEZ, i saw your works and downloaded the analog meter. It's great. is that possible to let it play more then 1 music? but it's perfect! :mellow:

Meba23 i tried your script but it write: Object creation failed. and an error message. (I attached it)

post-57268-1276798624272_thumb.jpg

Edited by Unc3nZureD
Link to comment
Share on other sites

I deleted the ßeta version and i'll install it again. I hope it will work! UEZ, i saw your works and downloaded the analog meter. It's great. is that possible to let it play more then 1 music? but it's perfect! :mellow:

Meba23 i tried your script but it write: Object creation failed. and an error message. (I attached it)

I never planned the Analog Meter to be a real music player! You have to drag'n'drop each mp3 manually! Maybe in the future...

I don't know why you cannot get it run properly!

Btw,

I modified Melba23's script a little bit:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

HotKeySet("{ESC}", "On_Exit")

$sPicPath = "c:\Program Files\AutoIt3\Examples\GUI\logo4.gif"

$sDimensions = ""
$oShellApp = ObjCreate("shell.application")
If IsObj($oShellApp) Then
    Local $oDir = $oShellApp.NameSpace("C:\Program Files\AutoIt3\Examples\GUI")
    If IsObj($oDir) Then
    Local $oFile = $oDir.Parsename("logo4.gif")
    If IsObj($oFile) Then
    If @OSBuild > 6000 Then
    $sDimensions = $oDir.GetDetailsOf($oFile, 31)
    ElseIf @OSVersion = "WIN_XP" Then
    $sDimensions = $oDir.GetDetailsOf($oFile, 26)
    EndIf
    EndIf
    EndIf
EndIf
If $sDimensions = "" Then Exit MsgBox(0, "Error", "Object creation failed")

$aDimensions = StringRegExp($sDimensions, "(?i)[\d]*x*[\d]", 3)
If Not IsArray($aDimensions) Then Exit MsgBox(0, "Error", "Cannot get image resolution!")

$hGUI = GUICreate("Test", $aDimensions[0], $aDimensions[1], Default, Default, $WS_POPUP)
GUICtrlCreatePic($sPicPath, 0, 0, $aDimensions[0], $aDimensions[1])

Dim $Gui_Effects_in[10] = [0x00090000, 0x00040001, 0x00040002, 0x00040005, 0x00040004, 0x00040006, 0x00040008, 0x00040009, 0x0004000a, 0x00040010]
Dim $Gui_Effects_out[9] =            [0x00050001, 0x00050002, 0x00050004, 0x00050006, 0x00050005, 0x00050008, 0x00050009, 0x0005000a, 0x00050010]

$effect = Random(0, 1, 1)

If $effect = 1 Then
    WinSetTrans($hGUI, "", 0)
Else
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hGUI, "int", 500, "short", $Gui_Effects_in[Random(1, 9, 1)])
EndIf
GUISetState()

If $effect = 1 Then
    For $i = 1 To 255 Step 2
        WinSetTrans($hGUI, "", $i)
        Sleep(10)
    Next
EndIf

Sleep(3500)

On_Exit()

Func On_Exit()
    $effect = Random(0, 1, 1)
    Switch $effect
        Case 0
            For $i = 255 To 0 Step -2
                WinSetTrans($hGUI, "", $i)
                Sleep(5)
            Next
        Case 1
            GUISetState(@SW_DISABLE, $hGUI)
            $hGUI = GUICreate("Test", $aDimensions[0], $aDimensions[1], Default, Default, $WS_POPUP, 0)
            DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hGUI, "int", 500, "short", $Gui_Effects_out[Random(0, 8, 1)])
            GUISetState(@SW_DISABLE, $hGUI)
    EndSwitch
    Exit
EndFunc

BR,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

I never planned the Analog Meter to be a real music player! You have to drag'n'drop each mp3 manually! Maybe in the future...

I don't know why you cannot get it run properly!

Btw,

I modified Melba23's script a little bit:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

HotKeySet("{ESC}", "On_Exit")

$sPicPath = "c:\Program Files\AutoIt3\Examples\GUI\logo4.gif"

$sDimensions = ""
$oShellApp = ObjCreate("shell.application")
If IsObj($oShellApp) Then
    Local $oDir = $oShellApp.NameSpace("C:\Program Files\AutoIt3\Examples\GUI")
    If IsObj($oDir) Then
    Local $oFile = $oDir.Parsename("logo4.gif")
    If IsObj($oFile) Then
    If @OSBuild > 6000 Then
    $sDimensions = $oDir.GetDetailsOf($oFile, 31)
    ElseIf @OSVersion = "WIN_XP" Then
    $sDimensions = $oDir.GetDetailsOf($oFile, 26)
    EndIf
    EndIf
    EndIf
EndIf
If $sDimensions = "" Then Exit MsgBox(0, "Error", "Object creation failed")

$aDimensions = StringRegExp($sDimensions, "(?i)[\d]*x*[\d]", 3)
If Not IsArray($aDimensions) Then Exit MsgBox(0, "Error", "Cannot get image resolution!")

$hGUI = GUICreate("Test", $aDimensions[0], $aDimensions[1], Default, Default, $WS_POPUP)
GUICtrlCreatePic($sPicPath, 0, 0, $aDimensions[0], $aDimensions[1])

Dim $Gui_Effects_in[10] = [0x00090000, 0x00040001, 0x00040002, 0x00040005, 0x00040004, 0x00040006, 0x00040008, 0x00040009, 0x0004000a, 0x00040010]
Dim $Gui_Effects_out[9] =    [0x00050001, 0x00050002, 0x00050004, 0x00050006, 0x00050005, 0x00050008, 0x00050009, 0x0005000a, 0x00050010]

$effect = Random(0, 1, 1)

If $effect = 1 Then
    WinSetTrans($hGUI, "", 0)
Else
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hGUI, "int", 500, "short", $Gui_Effects_in[Random(1, 9, 1)])
EndIf
GUISetState()

If $effect = 1 Then
    For $i = 1 To 255 Step 2
        WinSetTrans($hGUI, "", $i)
        Sleep(10)
    Next
EndIf

Sleep(3500)

On_Exit()

Func On_Exit()
    $effect = Random(0, 1, 1)
    Switch $effect
        Case 0
            For $i = 255 To 0 Step -2
                WinSetTrans($hGUI, "", $i)
                Sleep(5)
            Next
        Case 1
            $hGUI = GUICreate("Test", $aDimensions[0], $aDimensions[1], Default, Default, $WS_POPUP)
            DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hGUI, "int", 500, "short", $Gui_Effects_out[Random(0, 8, 1)])
            Sleep(50)
    EndSwitch
    Exit
EndFunc

BR,

UEZ

Object creation failed but now i don'T get the error msg :party: don't know what the hell happaned with my cmoputer :mellow::P
Link to comment
Share on other sites

Can you try the code on a different computer? Or try it with another user id, maybe profile problem.

BR,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...