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!
Splash Screen Taskbar Icon
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.
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.
Re: Splash Screen Taskbar Icon
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.
SAPIEN Technologies, Inc.
Re: Splash Screen Taskbar Icon
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.
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.
- Alexander Riedel
- Posts: 8478
- Last visit: Tue Mar 26, 2024 8:52 am
- Been upvoted: 37 times
Re: Splash Screen Taskbar Icon
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.
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.
SAPIEN Technologies, Inc.