Jump to content

Help with Splash screen


Digi
 Share

Recommended Posts

Hey there Guys and Girls :)

Hope everyone doing well?

I wonder if people can help me out here, Im trying to create a splash screen for my portable drive, using alot of stuffs from www.PortableApps.com.

Basically I have created a autorun that displays a nice little splash just with if found please return etc.

The code is something like this.

$ConfigFile = _GetConfigFile("autosplash.ini",True)

If $ConfigFile = "Error" Then Exit

$ImageFile = IniRead($ConfigFile,"General","ImageFile","SplashImage.jpg")

If StringMid($ImageFile,2,1)<>":" and StringMid($ImageFile,2,1)<>"\" Then
    $ImageFile = @ScriptDir & "\" & $ImageFile
EndIf

If Not FileExists($ImageFile) Then Exit

$ImageHeight = IniRead($ConfigFile,"General","ImageHeight",400)
$ImageWidth = IniRead($ConfigFile,"General","ImageWidth",246)
$Title = IniRead($ConfigFile,"General","Title","Digi's Drive")
$ShowTime = IniRead($ConfigFile,"General","ShowTime",3)
$ShowTitle = IniRead($ConfigFile,"General","ShowTitle",False)

If $ShowTitle = True Then
    $ShowTitleSetting = -1
Else
    $ShowTitleSetting = 1
EndIf

SplashImageOn($Title,$ImageFile,$ImageWidth,$ImageHeight,-1,-1,$ShowTitleSetting)
Sleep($ShowTime * 1000)
SplashOff()

Now the problem I have is this i want it to remove the window it draws around the image and i wonder is it possible to use a PNG file, so as to have a basic image that isnt square?

Thanks alot for any help you guys can give ;)

------------------------------------------------------------------------------

My Releases Thus Far...

Splash Screen Beta 5 (releases) - Splash Beta 5 Releases

Edited by Digi

Saru Mo Ki Kara Ochiru[u]Direct Translation[/u]: Even monkeys will fall from trees.[u]I.E.:[/u] To Error is HumanMy Splash Screen applet: Splash Screen Coding

Link to comment
Share on other sites

  • Replies 45
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

ah lol, Found out where the problem is the Statment i made

If $ShowTitle = True Then
$ShowTitleSetting = -1
Else
$ShowTitleSetting = 1
EndIf

As long as im calling from a INI then

If $ShowTitle = True Then

will always be false so needed to change it to

If $ShowTitle = "True" Then

Oh and just for anyone thats interested here is a copy of AUTOSPLASH.ini which is where im calling the ini values from

[General]
Title=Digi's Drive
ShowTitle=False
ImageFile=SplashImage.jpg
ImageWidth=304
ImageHeight=400
ShowTime=3
RunAfterApp=Truecrypt.exe

Now just looking at creating one with transparent backgrounds etc.... if anyone has ideas please let me know.

Else ill post it up when i figure it out. or find it somewhere in the forums ill post the link :)

Saru Mo Ki Kara Ochiru[u]Direct Translation[/u]: Even monkeys will fall from trees.[u]I.E.:[/u] To Error is HumanMy Splash Screen applet: Splash Screen Coding

Link to comment
Share on other sites

Ok i found something thats giving me a general idea.

Transparent Background.

But im not to good on the GUI side of things can anyone help me in how i might add this

; EXAMPLE SHOWING Bitmap to Region function ( BMP2RGN() )
;
; int BMP2RGN("str","path to BMP",
;   "int",red value,
;   "int",green value,
;   "int",blue value)
;
; The red, green, blue values should be the color of the pixel
; in the BMP that you DON't want to see.
;
#include <GUIConstants.au3>

$gui = GUICreate("",100,100,-1,-1, $WS_POPUP)
GUICtrlCreatePic("larry.bmp",0,0,100,100)
GUICtrlSetState(-1, $GUI_DISABLE)
$Button = GUICtrlCreateButton("button", 15, 40, 70, 20)
$a = DLLCall("BMP2RGN.dll","int","BMP2RGN", _
            "str","larry.bmp", _
            "int",0, _
            "int",0, _
            "int",0)
SetWindowRgn($gui, $a[0])
GUISetState(@SW_SHOW)
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $Button
            Exit
    EndSelect
WEnd

Func SetWindowRgn($h_win, $rgn)
    DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $rgn, "int", 1)
EndFuncoÝ÷ Ú)í¢l¡Ø§w«z+0«bººÞÙrjëh×6Dim $ConfigFile ;Configuration File
Dim $ImageFile ;Image to be shown.  Must be BMP,GIF or JPG
Dim $ImageWidth ;Width of the image to display in pixels
Dim $ImageHeight ;Height of image in pixels
Dim $Title ;Title to be displayed
Dim $ShowTime ;Length of time to display image in seconds
Dim $ShowTitle ;Determine whether or not to display the title
Dim $ShowTitleSetting ;Setting for ShowTitle

$ConfigFile = _GetConfigFile("autosplash.ini",True)

If $ConfigFile = "Error" Then Exit

$ImageFile = IniRead($ConfigFile,"General","ImageFile","SplashImage.jpg")

If StringMid($ImageFile,2,1)<>":" and StringMid($ImageFile,2,1)<>"\" Then
    $ImageFile = @ScriptDir & "\" & $ImageFile
EndIf

If Not FileExists($ImageFile) Then Exit

$ImageHeight = IniRead($ConfigFile,"General","ImageHeight",400)
$ImageWidth = IniRead($ConfigFile,"General","ImageWidth",304)
$Title = IniRead($ConfigFile,"General","Title","Digi's Drive")
$ShowTime = IniRead($ConfigFile,"General","ShowTime",3)
$ShowTitle = IniRead($ConfigFile,"General","ShowTitle",False)

If $ShowTitle = "True" Then
    $ShowTitleSetting = -1
Else
    $ShowTitleSetting = 1
EndIf

SplashImageOn($Title,$ImageFile,$ImageWidth,$ImageHeight,-1,-1,$ShowTitleSetting)
Sleep($ShowTime * 1000)
SplashOff()

$RunAfterApp = IniRead($ConfigFile,"General","RunAfterApp","")
If $RunAfterApp<>"" and FileExists($RunAfterApp) Then
    Run($RunAfterApp)
EndIf

#region Functions
Func _GetConfigFile($filename,$silent = False)
    Local $configfilename
    $configfilename = @ScriptDir & "\" & $filename

    If Not FileExists($configfilename) Then
        If Not $silent Then
            MsgBox(16,"File Missing","The file " & $filename & " is not available." & @CRLF & "Please ensure that it is located in the " & @ScriptDir & " directory." & @CRLF & "The application will now exit.")
            Exit
        EndIf
        SetError(1)
        Return "Error"
    EndIf
    Return $configfilename
EndFunc
#endregion
Edited by Digi

Saru Mo Ki Kara Ochiru[u]Direct Translation[/u]: Even monkeys will fall from trees.[u]I.E.:[/u] To Error is HumanMy Splash Screen applet: Splash Screen Coding

Link to comment
Share on other sites

  • 3 weeks later...

Ok after playing around a lil I got

#include <GUIConstants.au3>

$gui = GUICreate("",460,578,-1,-1, $WS_POPUP)
GUICtrlCreatePic("test.bmp",0,0,460,578)
GUICtrlSetState(-1, $GUI_DISABLE)
$a = DLLCall("BMP2RGN.dll","int","BMP2RGN", _
            "str","test.bmp", _
            "int",208, _
            "int",208, _
            "int",208)
SetWindowRgn($gui, $a[0])
GUISetState(@SW_SHOW)


Func SetWindowRgn($h_win, $rgn)
    DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $rgn, "int", 1)
EndFunc

Just Trying to figure out the Display time thing now, I did it with the button but i want a Timer. IE display for 4 seconds.

Saru Mo Ki Kara Ochiru[u]Direct Translation[/u]: Even monkeys will fall from trees.[u]I.E.:[/u] To Error is HumanMy Splash Screen applet: Splash Screen Coding

Link to comment
Share on other sites

Was really stupi dof me. lol Sleep daaaaaa...

Ok so here is what i got

#include <GUIConstants.au3>


$gui = GUICreate("",460,578,-1,-1, $WS_POPUP)
GUICtrlCreatePic("TEST.BMP",0,0,460,578)
GUICtrlSetState(-1, $GUI_DISABLE)
$a = DLLCall("BMP2RGN.dll","int","BMP2RGN", _
            "str","TEST.BMP", _
            "int",30, _;    RED
            "int",30, _;    Green
            "int",30);      Blue
SetWindowRgn($gui, $a[0])
GUISetState(@SW_SHOW)
;Soundplay("Testing.wav",0)
Sleep(4000)

Func SetWindowRgn($h_win, $rgn)
    DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $rgn, "int", 1)
EndFunc

Now i got one problem, I test the scripting and it works fine, i compile it and it works fine, but then i move it to my portable device (CD\DVD\Flash\ETC) and i get the following.

Line -1

Error: Subscript used with non-Array Variable

Does anyone know whats wrong here????

And lil side note, will the scripting i have Incorporate the image im using into the compiled exe? if now how would i do that?

PLEASE help, me lil man, basic knowladge as you can see so far lol.

:)

Edited (ADD):

Ok figured it out the script isnt including the BMP or the DLL in the compiled EXE. can anyone help me in how you include the files into the compiled EXE?

Edited by Digi

Saru Mo Ki Kara Ochiru[u]Direct Translation[/u]: Even monkeys will fall from trees.[u]I.E.:[/u] To Error is HumanMy Splash Screen applet: Splash Screen Coding

Link to comment
Share on other sites

And without using Fileinstall to place the file in a location on the system, i want to keep the file in the compiled scripting.

Saru Mo Ki Kara Ochiru[u]Direct Translation[/u]: Even monkeys will fall from trees.[u]I.E.:[/u] To Error is HumanMy Splash Screen applet: Splash Screen Coding

Link to comment
Share on other sites

And without using Fileinstall to place the file in a location on the system, i want to keep the file in the compiled scripting.

I see Zedna was working on EMBEDDING files so far looks like exactly what i want. now just gotta figure out how to get it to work here.

Zedna'a "Add and use binary data to/from resources, UDF - embed/use any data/files into/from AutoIt compiled EXE files"

Saru Mo Ki Kara Ochiru[u]Direct Translation[/u]: Even monkeys will fall from trees.[u]I.E.:[/u] To Error is HumanMy Splash Screen applet: Splash Screen Coding

Link to comment
Share on other sites

I see Zedna was working on EMBEDDING files so far looks like exactly what i want. now just gotta figure out how to get it to work here.

Zedna'a "Add and use binary data to/from resources, UDF - embed/use any data/files into/from AutoIt compiled EXE files"

As far as I know BMP2RGN.dll can work only with external BMP files on disk and not directly with resources.

So you must use your own "BMP2RGN" method using DllCalls and API functions (translate BMP2RGN.dll into native AU3). Then you may use BMP directly from resources with my resource UDF.

Search forum Larry posted many great stuff about that. But unfortunately he deleted his old posts some time ago.

EDIT: Here is link for start informations about similar API functions

Edited by Zedna
Link to comment
Share on other sites

wohoo found a Even better way to do the Splash, Thanks to Lod3n for his PNG stuffs :) Much cleaner images. ok so its a lil more coding but the tradeoff is worth it I think :)

#Include <GDIPlus.au3>
#Include <File.au3>
#include <GuiConstants.au3>
#Include <WinAPI.au3>
Opt("MustDeclareVars", 0)

Global Const $AC_SRC_ALPHA      = 1
Global Const $ULW_ALPHA         = 2
Global $old_string = "", $runthis = ""
Global $launchDir = @DesktopDir

_GDIPlus_Startup()
$pngSrc = @scriptdir & "\Splash TEST.png"
$hImage = _GDIPlus_ImageLoadFromFile($pngSrc)


$width =  _GDIPlus_ImageGetWidth ($hImage)
$height = _GDIPlus_ImageGetHeight($hImage)


$GUI = GUICreate("Digi's Splash", $width, $height, -1, -1, $WS_POPUP, $WS_EX_LAYERED)
SetBitMap($GUI, $hImage, 255)

GUISetState()
WinSetOnTop($gui,"",1)
_GDIPlus_Shutdown()
Sleep(4000)
  
Func SetBitmap($hGUI, $hImage, $iOpacity)
  Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend

  $hScrDC  = _WinAPI_GetDC($hGUI)
  $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", $AC_SRC_ALPHA)
  _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA)
  _WinAPI_ReleaseDC   (0, $hScrDC)
  _WinAPI_SelectObject($hMemDC, $hOld)
  _WinAPI_DeleteObject($hBitmap)
  _WinAPI_DeleteDC    ($hMemDC)
EndFunc

now still looking at the Embedding idea lol.

EDIT: A lil help here please Zedna :party:

Edited by Digi

Saru Mo Ki Kara Ochiru[u]Direct Translation[/u]: Even monkeys will fall from trees.[u]I.E.:[/u] To Error is HumanMy Splash Screen applet: Splash Screen Coding

Link to comment
Share on other sites

Just wanted to say a HUGE Thanks to everyone that has helped,

And HUGE HUGE HUGE Thanks to

Zedna

and

Lod3n

EDIT: Oh and Larry for the Early Beta Phase of it :) will prob use those Ideas for other thingys :party:

whos Scripting is helping me accomplish this.

Ill be Linking the complete scripting for download with basic instructions how to Edit soon as I get it working properly :lmao:

cause I see there are alot of people looking for a easy way to get the SPLASH done. :) havent even had a chance to go through everything yet.

Edited by Digi

Saru Mo Ki Kara Ochiru[u]Direct Translation[/u]: Even monkeys will fall from trees.[u]I.E.:[/u] To Error is HumanMy Splash Screen applet: Splash Screen Coding

Link to comment
Share on other sites

wohoo found a Even better way to do the Splash, Thanks to Lod3n for his PNG stuffs :) Much cleaner images. ok so its a lil more coding but the tradeoff is worth it I think :)

now still looking at the Embedding idea lol.

<B>EDIT: A lil help here please Zedna :party:

Look here

there are unfinished these API calls:

CreateStreamOnHGlobal

GdipLoadImageFromStream

Edited by Zedna
Link to comment
Share on other sites

Can you post "Splash TEST.png"?

Maybe I can play with it little bit.

Sure thing :)

I wont post the Au3 seeming as its all here already, what I currently Have.

:) this is as i say just a test image, I'll give people assist on what to change and how when i figure out everything :party:

Thanks again for the Help Zedna :lmao:

post-17485-1206637630_thumb.png

Saru Mo Ki Kara Ochiru[u]Direct Translation[/u]: Even monkeys will fall from trees.[u]I.E.:[/u] To Error is HumanMy Splash Screen applet: Splash Screen Coding

Link to comment
Share on other sites

Hey there Everyone,

I was Going over it this morning and i think Ill Give out the Beta Version of this applet

And update it as we go Along, till i get the Final product released, This so far works perfectly, and there are no errors that i can see thus far. I have also included a real basic Help doc on how to change everything and a few other details

The ZIP contains 4 files.

Splash.Au3

Splash Screen.PNG

Spalsh.EXE

Readme (How to Edit and Use).DOC

The Splash.exe is a compiled working copy of the Applet.

N.B.

Remember that both the EXE and the PNG must be in the same location for it to work at this point.

All in all the Applet and all files is 618k Unzipped, 587k Zipped.

Current To do List:
Create a Embedded EXE

Phase 2:
Create a basic easy to use interface to create the Splash screen.

EDIT: GRR forgot to add the file lol, Doesnt wanna, Please can someone PM me with a good site to host files?

EDIT2: Lol nevermind, Created this as a Project on Sourceforge, :) its gonna be free for all anyway :) So now its a Beta Project :party:

All those who assist will get Credited on the project details, less they dont want to be named.

*ADMIN REQUEST please can any admin let me know if it is OK to publish the original scripting along with the complete applet, I have also added links to http://www.autoitscript.com/ in the readme should anyone downloading it wish to edit in any way.* Thanks

Ill post the link soon as i get feedback from source forge and the AutoIT admins.

Edited by Digi

Saru Mo Ki Kara Ochiru[u]Direct Translation[/u]: Even monkeys will fall from trees.[u]I.E.:[/u] To Error is HumanMy Splash Screen applet: Splash Screen Coding

Link to comment
Share on other sites

Got a reply From Jon one of the Admins and from them its cool if i post everything I have.

Soon as i get the OK from source forge i will be posting the files and a link for them.

Saru Mo Ki Kara Ochiru[u]Direct Translation[/u]: Even monkeys will fall from trees.[u]I.E.:[/u] To Error is HumanMy Splash Screen applet: Splash Screen Coding

Link to comment
Share on other sites

Hey there Everyone,

I was Going over it this morning and i think Ill Give out the Beta Version of this applet

And update it as we go Along, till i get the Final product released, This so far works perfectly, and there are no errors that i can see thus far. I have also included a real basic Help doc on how to change everything and a few other details

The ZIP contains 4 files.

Splash.Au3

Splash Screen.PNG

Spalsh.EXE

Readme (How to Edit and Use).DOC

The Splash.exe is a compiled working copy of the Applet.

N.B.

Remember that both the EXE and the PNG must be in the same location for it to work at this point.

All in all the Applet and all files is 618k Unzipped, 587k Zipped.

Current To do List:
Create a Embedded EXE

Phase 2:
Create a basic easy to use interface to create the Splash screen.

EDIT: GRR forgot to add the file lol, Doesnt wanna, Please can someone PM me with a good site to host files?

EDIT2: Lol nevermind, Created this as a Project on Sourceforge, :) its gonna be free for all anyway :) So now its a Beta Project :party:

All those who assist will get Credited on the project details, less they dont want to be named.

*ADMIN REQUEST please can any admin let me know if it is OK to publish the original scripting along with the complete applet, I have also added links to http://www.autoitscript.com/ in the readme should anyone downloading it wish to edit in any way.* Thanks

Ill post the link soon as i get feedback from source forge and the AutoIT admins.

Hey, where is the link to the sourceforge page and download??? This is something i have been looking for!
Link to comment
Share on other sites

Hey, where is the link to the sourceforge page and download??? This is something i have been looking for!

Hey Guys / Girls Sorry have been extremely busy this side of the world,

I have gotten the OK from sourceforge, but cant access the FTP from my current location, I will be posting the links ETC tonight from home. I have added a complete Easy to follow guide and instructions.

Its currently 9:20 AM here so its about 9 hours time ill have everything up and linked :) sorry for the delay in getting it out.

Saru Mo Ki Kara Ochiru[u]Direct Translation[/u]: Even monkeys will fall from trees.[u]I.E.:[/u] To Error is HumanMy Splash Screen applet: Splash Screen Coding

Link to comment
Share on other sites

Where is it???

Ok the really really annoying source forge didnt wanna work, i tried all weekend, So posted on another Share site.

Free Share of Splash Screen

Try it and ill keep working on the Sorceforge issue.

If anyone has a better Freesource share point let me know please.

EDIT: Sorry the file is 587KB, so small and Fast

It has the following in it:

Readme (How to Edit and Use).doc

Splash Screen.png

Splash.au3

Splash.exe

Hope you all enjoy it.

Edited by Digi

Saru Mo Ki Kara Ochiru[u]Direct Translation[/u]: Even monkeys will fall from trees.[u]I.E.:[/u] To Error is HumanMy Splash Screen applet: Splash Screen Coding

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...