adflow

Technical details

How adflow for Windows measures, places and runs itself, what you can set on the command line, and what the server sends. None of this is needed to use it.

Behavior

It behaves like system chrome.

No window elbowing its way forward. The bar sits in the strip Windows claims for itself anyway, and keeps to its measurements.

OPENING
By click only

Nothing expands on its own. The spot changes every 60 s in the compact state too, and the bar stays narrow while it does. One click expands and holds it open, the next collapses it.

GEOMETRY
The height is fixed

Only width and position move. The rounded corners face into the screen, the flat side lies along the edge. If the taskbar sits at the top, that flips automatically.

LIMIT
Collapsed, truncate rather than cover

Collapsed, the display stands there permanently, so it never gets wider than the widest free strip, and never wider than 55 % of the bar. If the line does not fit it is truncated rather than laid over the icons. Expanded, that does not apply: that is a deliberate click, so it may take its full length.

MEASUREMENTS
Two thirds, measured at runtime

SHAppBarMessage(ABM_GETTASKBARPOS) supplies the edge, position and height of the bar, and the display takes two thirds of it. At 48 px the Windows taskbar is roughly twice as tall as the macOS menu bar. Filled to the brim, the display looks clunky there. Type, badge and button hang off the same number, so everything scales along. --scale 0.8 tunes it.

FOCUS
Interrupts nothing

WS_EX_NOACTIVATE, plus MA_NOACTIVATE on every click: the display never becomes active and never takes focus from the app in front. The price is having to quit via ✕ or Ctrl+Alt+Esc.

DRAWING
Real transparency

Drawing goes into a 32-bit ARGB bitmap, set via UpdateLayeredWindow. That makes the rounded corners genuinely transparent, and clicks beside them pass through to the taskbar underneath.

BUILD
One file, no baggage

Adflow.cs, compiled with the csc.exe that sits inside the .NET Framework in Windows. No SDK, no package manager, no download.

It never covers your buttons.

On Windows 11 the group of Start, Search and app buttons sits in the middle, with the notification area on the right. Two flanks remain between them. The display takes the one where it has to slide the least out of center. Drag the sliders.

free
Start + app buttons
free
Notification area
NEBULA COFFEE
free …   width …   x …   …

What counts as occupied is worked out three ways. First, the accessibility tree of the bar. Exact, on Windows 10 as on Windows 11: every button reports its real rectangle there, even when it long ago stopped being a window of its own. Second, the classic windows of Windows 10 (MSTaskListWClass, TrayNotifyWnd), checked for visibility, because on Windows 11 that chain of windows lives on as an invisible remnant and reports nonsense. Third, as a last resort, an estimate from the number of taskbar windows, deliberately with a safety margin: estimating too narrow would mean the display sits on the icons. Which route is in play right now is shown by adflow.exe --probe.

Double-click. That is the setup.

The download contains a finished .exe. No installer, nothing to compile, nothing that writes into Windows.

  1. Unpack the zip and open adflow.exe

    Put the folder wherever you like. The program runs from where it sits and does not install itself.

  2. Allow it once, on the first run

    Click More info, then Run anyway. That is a one-time step for the archive route; the one-line install skips it. After that the program starts normally, every time.

  3. Enter your ID and passkey

    The program asks for them itself, in a small window, right after the first start. Paste in the two lines you got with the download. You can also skip it: the bar then shows demo spots and earns nothing.

Once it runs

Click the baropens it, click again and it closes
Right-clickjumps to the next spot
Click the crossquits
Ctrl + Alt + Escquits from anywhere, even if the bar is hidden
If you would rather use the command line

None of this is necessary. It is here for people who want it.

Build it yourself

rem start, rebuilds when needed
windows\run.cmd

rem or in two steps
windows\build.cmd
windows\adflow.exe

Compiled by csc.exe from .NET Framework 4.x, which is already on every Windows 10 and 11. Nothing to download.

Account

adflow.exe --pair DIA-XXXXX-XXXXX XXXXX-XXXXX-XXXXX-XXXXX
adflow.exe --account
adflow.exe --logout

The same thing the program asks for in its own window. The passkey goes over the wire exactly once; after that only a device token sits in %APPDATA%\Adflow, readable by you alone.

Size and side

adflow.exe --scale 0.8
adflow.exe --maxwidth 600
adflow.exe --prefer left

--scale sets the height as a fraction of the taskbar, default 0.66. --maxwidth caps the width in pixels, open state included. --prefer picks the side of the centre group.

See what it measures

adflow.exe --probe

Shows for 20 seconds where the bar sits, which strips of the taskbar are occupied and by what, and where the display moves as a result. Open and close windows while it runs.

Where the spots come from

Nothing to configure.

The app fetches the current spots from the server when it starts, and again every 15 minutes. You never edit anything, and you never restart anything. If you want to run a spot yourself, you book one, same as any other advertiser.

What a spot looks like on the wire

For the curious. This is the JSON the app receives from ads.php. Nothing here is anything you have to do.

{
  "brand":  "YOUR BRAND",
  "tag":    "Line under the name",
  "body":   "Line that appears only when the bar is open.",
  "cta":    "Button text",
  "mark":   "M",          // letter in the badge
  "accent": "#FF9F0A"     // accent colour
}
Always there
brand, tag, accent

Without these a spot is skipped. If mark is missing, the first letter of the brand is used.

Optional
body, cta

Left empty, the body line and the button simply do not appear. The bar then shows the brand and the line under it.

If the server is unreachable
It keeps running

The spots built into the program take over, so the bar always has something to show. Those do not earn anything, and nothing is reported.

Widths are not configured anywhere. The app measures the text and works out the two widths from it, which is why a longer brand name simply makes the bar wider.