Skip to content

Commit

Permalink
Controlling via stdin/out
Browse files Browse the repository at this point in the history
  • Loading branch information
stegru committed Jul 14, 2020
0 parents commit bd565a9
Show file tree
Hide file tree
Showing 7 changed files with 1,177 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.obj
*.*proj.user
*.pdb
/Debug/
/Release/
60 changes: 60 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Task tray button

Displays a button on the task tray, by shrinking the window list and positioning itself between that and the
notification area.

The taskbar is a window, having child windows like this:

[start][search][windows ][icons|clock]


The tray button is just another child window, inserted between the window list and icons:

[start][search][windows ][button][icons|clock]


This was extracted from the original Morphic application, [gpii-app/trayButton](https://github.com/GPII/gpii-app/tree/master/trayButton).

## Build

Run `build.ps1`, or use Visual Studio.

## Operation

### Control

It is controlled by the parent process via standard input, with the following commands:

Set the icon to `file`:

ICON file

Set the high-contrast icon to `file`:

ICON_HC file

Set the tooltip `text`:

TOOLTIP text

Specify a window handle `hwnd` belonging to the parent process, to focus when the button is clicked:

HWND hwnd

Set the checked state to `bool`:

STATE bool

Remove the icon, re-adjust the taskbar, and end the process:

DESTROY

### Events

The tray-button process will produce the following notifications on its standard output:

* `CLICK`: The left button is clicked.
* `SHOWMENU`: The right button is clicked.
* `MOUSEENTER`, `MOUSELEAVE`: The mouse cursor has entered or left the button.
* `POSITION MAKELONG(x,y) MAKELONG(w,h): Position of the button has changed.
* `UPDATE`: Configuration is required.
1 change: 1 addition & 0 deletions build.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
powershell -ExecutionPolicy ByPass "%~dp0\build.ps1"
21 changes: 21 additions & 0 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Function Get-MSBuild {
Param (
[Parameter(Mandatory=$true)]
[string] $version
)

# TODO: Check version validity.
# Valid versions are [2.0, 3.5, 4.0]

$dotNetVersion = $version
$regKey = "HKLM:\software\Microsoft\MSBuild\ToolsVersions\$dotNetVersion"
$regProperty = "MSBuildToolsPath"

$msbuild = Join-Path -path (Get-ItemPropertyweb.tw $regKey).$regProperty -childpath "msbuild.exe"

return $msbuild
}


$msbuild = Get-MSBuild "4.0"
Start-Process -FilePath $msbuild -ArgumentList "tray-button.vcxproj /p:Configuration=Release" -PassThru -NoNewWindow
Loading

0 comments on commit bd565a9

Please sign in to comment.