Load Splash Screen Immediately

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 1 year and 5 months 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.
Locked
User avatar
cory.freeman@nortonhealthcare.org
Posts: 4
Last visit: Thu Mar 07, 2024 7:16 am

Load Splash Screen Immediately

Post by cory.freeman@nortonhealthcare.org »

Has anyone been able to get a Splash screen to load as soon as your gui .exe is clicked? Basically my GUI takes 5-8 seconds to load (gathering data) and I want to have a splash screen load during that time so users don't click the .exe again and again. Any help is appreciated.
User avatar
Domtar
Posts: 133
Last visit: Mon Mar 11, 2024 5:38 am
Has voted: 2 times

Re: Load Splash Screen Immediately

Post by Domtar »

i do this in the load event of my main form.

Code: Select all

$mainForm_load = {
	$CM2012CmdletModule = ($Env:SMS_ADMIN_UI_PATH.Substring(0, $Env:SMS_ADMIN_UI_PATH.Length - 5) + '\ConfigurationManager.psd1')
	if (Test-Path -Path $CM2012CmdletModule)
	{
		$splashScreen = Show-SplashScreen -passtrue $true
		import-module $CM2012CmdletModule -force -erroraction SilentlyContinue
		$splashScreen.Close()
	} else
	{
		(New-Object -ComObject WScript.Shell).popup("The SCCM module wasn't detected on this computer. Please make sure the SCCM module is installed (SCCM Console required) and restart this Client Center.", 0, 'ERROR: No SCCM module detected!', 0)
		return
	}
}

function Show-SplashScreen {
	# form code here
}
This topic is 1 year and 5 months 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.
Locked