How do I set a hot corner in Windows 7?
Actually, Windows screensavers did have this feature (at least those included as part of the Plus! pack, which old-timers should remember):
Indeed, a really useful bug made the hot corners specified for Plus! screensavers a global setting that applied to non-Plus! screensavers as well!
The easiest way to get similar functionality in Windows now might be to use an AutoIT app (source available) called, not surprisingly, Hot Corners. It can also do various other interesting things besides launching the screensaver:
Here is a hotcorners app that I wrote, hope you enjoy it! I have also released the source on github.
Details can be found on: https://sites.google.com/site/bytecar/home/hotcornersapp
Happy Hacking!
Here's my quickie PowerShell version of this if anybody is interested (shameless blog post plug) (or GitHub)
this code watches for mouse in certain position (currently lower right corner) and then triggers Win32 monitor power-off API... it displays a task tray icon as a visible running indicator along with a context menu to end execution
unfortunately i'm too green to post screenshots... for now please refer to the github link for robust info
# Source: http://www.powershellmagazine.com/2013/07/18/pstip-how-to-switch-off-display-with-powershell/
# Turn display off by calling WindowsAPI.
# SendMessage(HWND_BROADCAST,WM_SYSCOMMAND, SC_MONITORPOWER, POWER_OFF)
# HWND_BROADCAST 0xffff
# WM_SYSCOMMAND 0x0112
# SC_MONITORPOWER 0xf170
# POWER_OFF 0x0002
Add-Type -TypeDefinition '
using System;
using System.Runtime.InteropServices;
namespace Utilities {
public static class Display
{
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern IntPtr SendMessage(
IntPtr hWnd,
UInt32 Msg,
IntPtr wParam,
IntPtr lParam
);
public static void PowerOff ()
{
SendMessage(
(IntPtr)0xffff, // HWND_BROADCAST
0x0112, // WM_SYSCOMMAND
(IntPtr)0xf170, // SC_MONITORPOWER
(IntPtr)0x0002 // POWER_OFF
);
}
}
}
'
Add-Type -AssemblyName System.Windows.Forms
$notifyIcon = New-Object System.Windows.Forms.NotifyIcon
$notifyIcon.Icon = New-Object System.Drawing.Icon "$(Split-Path -parent $PSCommandPath)\icon.ico"
$notifyIcon.Text = "Hot Corners"
$notifyIcon.add_MouseDown( {
if ($script:contextMenu.Visible) { $script:contextMenu.Hide(); return }
if ($_.Button -ne [System.Windows.Forms.MouseButtons]::Left) {return}
#from: http://stackoverflow.com/questions/21076156/how-would-one-attach-a-contextmenustrip-to-a-notifyicon
#nugget: ContextMenu.Show() yields a known popup positioning bug... this trick leverages notifyIcons private method that properly handles positioning
[System.Windows.Forms.NotifyIcon].GetMethod("ShowContextMenu", [System.Reflection.BindingFlags] "NonPublic, Instance").Invoke($script:notifyIcon, $null)
})
$contextMenu = New-Object System.Windows.Forms.ContextMenuStrip
$contextMenu.ShowImageMargin = $false
$notifyIcon.ContextMenuStrip = $contextMenu
$contextMenu.Items.Add( "E&xit", $null, { $notifyIcon.Visible = $false; [System.Windows.Forms.Application]::Exit() } ) | Out-Null
$contextMenu.Show(); $contextMenu.Hide() #just to initialize the window handle to give to $timer.SynchronizingObject below
$timer = New-Object System.Timers.Timer
$timer.Interval = 500
$timer.add_Elapsed({
$mouse = [System.Windows.Forms.Cursor]::Position
$bounds = [System.Windows.Forms.Screen]::FromPoint($mouse).Bounds #thank you! - http://stackoverflow.com/questions/26402955/finding-monitor-screen-on-which-mouse-pointer-is-present
<# __ __ _ __ __ __ ____
/ / / /__ ________ ( )_____ / /_/ /_ ___ / /_ ___ ___ / __/
/ /_/ / _ \/ ___/ _ \|// ___/ / __/ __ \/ _ \ / __ \/ _ \/ _ \/ /_
/ __ / __/ / / __/ (__ ) / /_/ / / / __/ / /_/ / __/ __/ __/
/_/ /_/\___/_/ \___/ /____/ \__/_/ /_/\___/ /_.___/\___/\___/_/ #>
# currently set to trigger at lower right corner... season to your own taste (e.g. upper left = 0,0)
if ($mouse.X-$bounds.X -gt $bounds.Width-10 -and $mouse.Y -gt $bounds.Height-10) { [Utilities.Display]::PowerOff() }
#run the ps1 from command line to see this output
#debug: Write-Host "x: $($mouse.X), y:$($mouse.Y), width: $($bounds.Width), height: $($bounds.Height), sleep: $($mouse.X-$bounds.X -gt $bounds.Width-10 -and $mouse.Y -gt $bounds.Height-10)"
})
#frugally reusing $contextMenu vs firing up another blank form, not really necessary but i was curious if it'd work... the notify icon itself does not implement InvokeRequired
#see this for why SynchronizingObject is necessary: http://stackoverflow.com/questions/15505812/why-dont-add-eventname-work-with-timer
$timer.SynchronizingObject = $contextMenu
$timer.start()
$notifyIcon.Visible = $true
[System.Windows.Forms.Application]::Run()