When CLR not really clear

Started by spl, August 12, 2024, 08:43:39 AM

Previous topic - Next topic

spl

I know Balloon notifications have been covered in WB, but am curious about using CLR for a notification. This code
ObjectClrOption('useany', 'System')
ObjectCLrOPtion('useany', 'PresentationFramework')
ObjectCLrOPtion('useany', 'PresentationCore')
ObjectCLrOPtion('useany', 'System.Windows.Forms')
ObjectCLrOPtion('useany', 'System.Drawing')
balloon = ObjectClrNew('System.Windows.Forms.NotifyIcon')
;for testing add your own path to icon
;icon = ObjectClrType('System.Drawing.icon',"c:\scripts\sd.ico")
icon = ObjectClrType('System.Windows.Forms.ToolTipIcon',1)
balloon.Visible = ObjectType("BOOL",@TRUE)
;balloon.BalloonTipText = "CurrentApplication"
balloon.ShowBalloonTip(10000, "Look At Me","CurrentApplication",icon)
balloon.Dispose()
Exit

doesn't error, but also doesn't work as this does in PS
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing
$notify = new-object system.windows.forms.notifyicon
$notify.icon = [System.Drawing.SystemIcons]::Information
$notify.visible = $true
$notify.showballoontip(10000,'Current Operation','Script has been completed',[system.windows.forms.tooltipicon]::Info)
$notify.Dispose()

Obvious I am doing something wrong with WB code, what is it?
Stan - formerly stanl [ex-Pundit]

td

Just guessing but you may need to hang .Net notifications on .Net 'System.Windows.Forms' application.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade