Splash Screen Taskbar Icon

Use this forum to ask questions after your subscription maintenance expires or before you buy. Need information on licensing or pricing? Questions about a trial version? This is the right place for you. No scripting questions, please.
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
This topic is 11 months and 3 weeks old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Aoemilad
Posts: 3
Last visit: Fri May 19, 2023 11:03 am

Splash Screen Taskbar Icon

Post by Aoemilad »

Product, version and build: PowerShell Studio, Version 5.8.207
Operating system: Windows 10
PowerShell version(s): 5
64-bit version of software
----------------------------------------------------------------------------
I'm building a form with a splash screen. Everything works except one thing:

- For the duration of my splash screen, the icon that appears in the taskbar is the default PowerShell one.

Note that this only happens AFTER I've built the program into an exe package. Since the splash screen form code is embedded in the script section, I'm able to change the splash screen icon in the code:

#Create a splash screen form to display the image.
$splashForm = New-Object System.Windows.Forms.Form
$splashForm.Icon = ".\icon.ico"

This works when I click run but not after I package it into an exe.
I assume it's because when you package your form it only uses the Form.psf and doesn't include any external files into the build.
I'm new to PSStudio so I'd appreciate the advice!
User avatar
brittneyr
Site Admin
Posts: 1654
Last visit: Wed Mar 27, 2024 1:54 pm
Answers: 39
Been upvoted: 30 times

Re: Splash Screen Taskbar Icon

Post by brittneyr »

Is the icon file located in the same folder as the executable? From your code snippet, you are loading it from there.
Brittney
SAPIEN Technologies, Inc.
Aoemilad
Posts: 3
Last visit: Fri May 19, 2023 11:03 am

Re: Splash Screen Taskbar Icon

Post by Aoemilad »

Yes its in the same directory. But the executable file doesn't seem to be able to load it for some reason.

I was actually able to figure out a way around it.

I opened the MainForm.Run.ps1 file and was able to see that PSStudio converts images to binary format and then back when packaging their builds.
So I copied the base64 string of the icon and turned it into a function which returns a deserialized version that I can use as an icon, so I can call it whenever I need it!

Still not sure how to include relative paths in builds though since the build feature only packages the active script/form.
User avatar
Alexander Riedel
Posts: 8478
Last visit: Tue Mar 26, 2024 8:52 am
Answers: 19
Been upvoted: 37 times

Re: Splash Screen Taskbar Icon

Post by Alexander Riedel »

The packager allows you to add multiple icons to the exe file.
https://learn-powershell.net/2016/01/18 ... owershell/
This explains how you can load an icon from any exe (or dll), including the own process.
Alexander Riedel
SAPIEN Technologies, Inc.
This topic is 11 months and 3 weeks old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.