问题
in Windows 10 there are those gray notification boxes in the lower right corner. They come when you plug in a USB, when Updates were installed or when a virus was found by windows defender.
My question: How can i create these things? (with a custom message), if possible in vbs or batch as than they would be the easy to call from all programming languages. I know that this is possible as these boxes will also popup when someone pokes you in teamspeak.
Thank you for any answers!
回答1:
Those are toast notifications and they come from Universal Windows Apps.
Hear are couple of posts:
- http://blogs.msdn.com/b/tiles_and_toasts/archive/2015/07/08/toast-notification-and-action-center-overview-for-windows-10.aspx
- http://blogs.msdn.com/b/tiles_and_toasts/archive/2015/07/09/quickstart-sending-a-local-toast-notification-and-handling-activations-from-it-windows-10.aspx
- https://www.whitebyte.info/programming/c/how-to-make-a-notification-from-a-c-desktop-application-in-windows-10
I don't think you can create them any other way than by creating a universal app.
回答2:
An easier way to achieve windows8/10 notification toast is with Powershell.
[reflection.assembly]::loadwithpartialname("System.Windows.Forms")
[reflection.assembly]::loadwithpartialname("System.Drawing")
$notify = new-object system.windows.forms.notifyicon
$notify.icon = [System.Drawing.SystemIcons]::Information
$notify.visible = $true
$notify.showballoontip(10,"New Chat!","You have received New Chat!",[system.windows.forms.tooltipicon]::None)
execute above script in powershell console.
来源:https://stackoverflow.com/questions/34980977/create-custom-windows-10-notification-boxes