Windows 7 Notification #17

Open
opened 2023-10-03 16:03:36 -04:00 by efrick · 0 comments
Owner

It might be possible to add a system notification for Windows 7 computers.
The following was generated by Bing Bot.

function Show-Notification {
param (
[string]$Message = "Hello from PowerShell",
[string]$Title = "Notification"
)
# Load the System.Windows.Forms assembly
Add-Type -AssemblyName System.Windows.Forms
# Create a new NotifyIcon object
$notifyIcon = New-Object System.Windows.Forms.NotifyIcon
# Set the icon to the PowerShell icon
$path = (Get-Process -id $pid).Path
$notifyIcon.Icon = [System.Drawing.Icon]::ExtractAssociatedIcon($path)
# Set the balloon tip properties
$notifyIcon.BalloonTipIcon = [System.Windows.Forms.ToolTipIcon]::Info
$notifyIcon.BalloonTipText = $Message
$notifyIcon.BalloonTipTitle = $Title
# Make the icon visible
$notifyIcon.Visible = $true
# Show the balloon tip
$notifyIcon.ShowBalloonTip(20000)
}
It might be possible to add a system notification for Windows 7 computers. The following was generated by Bing Bot. ```powershell function Show-Notification { param ( [string]$Message = "Hello from PowerShell", [string]$Title = "Notification" ) # Load the System.Windows.Forms assembly Add-Type -AssemblyName System.Windows.Forms # Create a new NotifyIcon object $notifyIcon = New-Object System.Windows.Forms.NotifyIcon # Set the icon to the PowerShell icon $path = (Get-Process -id $pid).Path $notifyIcon.Icon = [System.Drawing.Icon]::ExtractAssociatedIcon($path) # Set the balloon tip properties $notifyIcon.BalloonTipIcon = [System.Windows.Forms.ToolTipIcon]::Info $notifyIcon.BalloonTipText = $Message $notifyIcon.BalloonTipTitle = $Title # Make the icon visible $notifyIcon.Visible = $true # Show the balloon tip $notifyIcon.ShowBalloonTip(20000) } ```
efrick added the
enhancement
label 2023-10-03 16:03:36 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: efrick/Sysinfo#17
No description provided.