Drawing my own cursor: hiding the real one and keeping overlays out of the capture
Short answer: to record a screen without the cursor and draw a nicer one later, swap every system cursor for a transparent one while recording (SetSystemCursor), and put the real ones back with SystemParametersInfo(SPI_SETCURSORS), including on the next launch in case the app died. So the person recording can still see where they're pointing, draw a stand in cursor in a click through, always on top window that's excluded from capture with SetWindowDisplayAffinity(WDA_EXCLUDEFROMCAPTURE), which is what Electron's setContentProtection(true) sets on Windows 10 version 2004 and later. Log the cursor's position, clicks and shape, and draw it into the video at export.
That's how Framok, my screen recorder for Windows, does its cursor. It took three goes to get right. Here's what each one taught me.
Why draw the cursor at all
A cursor recorded into the video is stuck the way it was: the size, the colour, every wobble of your hand. If you record the cursor as data instead (where it was every few milliseconds, when it clicked and what shape it was), the editor can draw it bigger, smoother or in a different style after the fact, and change its mind as often as it likes.
So the recording itself needs no cursor in it. And that's where it gets awkward, because the person recording still needs one.
Go 1: hide it everywhere, and nothing else
The first build, on 5 Sep, did the obvious thing. When recording starts, every system cursor (arrow, hand, text beam, the resize arrows, the spinner, 13 in all) gets swapped for a 32 by 32 cursor that's fully transparent. Windows has a call for exactly that, SetSystemCursor. It takes ownership of the cursor you hand it, so the code makes a fresh copy of the blank for each of the 13.
The recording came out clean. The catch is obvious in hindsight: the cursor is gone for the person recording too. You're trying to click through a demo with no pointer on screen.
There was a nastier catch hiding in there. SetSystemCursor changes the cursor for the whole system, not just your app. If the app crashes mid recording, the restore never runs and the user's cursor stays invisible after the app has gone. So a later commit the same day added a forced restore at startup: whatever state the last run left, the next launch reloads the user's own cursor scheme with SystemParametersInfo and SPI_SETCURSORS before doing anything else.
Go 2: a stand in cursor the capture can't see
The fix, a day later (6 Sep), was to draw a cursor for the person recording in a window of its own, and keep that window out of the recording.
One overlay per display, each a frameless, transparent window the size of the screen:
- Click through.
setIgnoreMouseEvents(true)passes every click to whatever is underneath. Electron's docs: "All mouse events happened in this window will be passed to the window below this window" (Electron). - Never steals focus.
focusable: false, which on Windows also keeps it off the taskbar, and shown withshowInactive(). - On top of everything.
setAlwaysOnTop(true, 'screen-saver'). Electron's docs say levels frompop-up-menuup sit above the taskbar on Windows (Electron). - Invisible to capture.
setContentProtection(true). On Windows this "calls SetWindowDisplayAffinity with WDA_EXCLUDEFROMCAPTURE": from Windows 10 version 2004 the window is removed from capture entirely, and older versions capture a black window instead (Electron). Microsoft's own example for that flag is this exact job: "windows that show video recording controls, so that the controls are not included in the capture" (Microsoft Learn).
Then a timer in the main process reads the real cursor position every 8 ms and sends it to the overlay on that display, only when something changed. The overlay moves an SVG arrow with a CSS transform, offset by the hotspot so the tip of the drawn arrow sits where the real hotspot is.
Pausing hands the real cursor back, so you can set up the next step without it landing in the recording.
How to prove a window isn't in the capture
"It's excluded from capture" is easy to claim and annoying to check by eye, because your own screen always shows the window. The check I trust is a capture probe: take a real screen capture with the window up and count pixels of a colour only that window uses.
I used the same method in Qulok, my focus app, whose timer and Restore pill use the same flag. With protection on, the only pixels in Qulok's accent gold in the capture were the launcher's own, 599 of them. With it off, 2,653.
Two catches worth knowing. Microsoft says the flag "works only when the Desktop Window Manager (DWM) is composing the desktop" and that there's "no guarantee" it protects anything, since someone can always photograph the screen (Microsoft Learn). And Electron's current docs note the change lands with the next desktop composition, not when the call returns, so a capture started straight after can still contain the window. Create the overlays before capture starts, not in the same breath.
Go 3: knowing what shape the cursor is
A drawn cursor that's always an arrow looks wrong the moment you hover a link or a text box. So the recorder also logs the cursor's shape, about every 33 ms, by asking Windows for the current cursor with GetCursorInfo and comparing its handle with the standard ones. GetCursorInfo returns a handle to "the global cursor" (Microsoft Learn), and LoadCursor with no instance hands back the existing handle of a system cursor rather than loading a new one (Microsoft Learn), so the arrow, hand and text beam can be told apart by handle.
On the first try, every hand and text beam in Chrome came back as "arrow". The handles were fine: Chromium draws the shared system cursors, and SetSystemCursor swaps the image behind a shared handle without changing the handle, so the comparison should have worked. The lookup table was the problem. It was built after the blanking, and the blank stand ins had been spread over the standard handles and shadowed them, so nothing ever matched. Loading the standard cursors at startup, before anything is blanked, fixed it.
Two fallbacks cover apps that load their own cursors instead of sharing the system ones:
- An exact match on the cursor's bits, hashed and compared with fingerprints taken before blanking.
- The hotspot's position inside the drawn shape. A text beam is a tall thin outline held halfway down. A pointing hand is held at the fingertip, on the top edge but inset from the left the way an arrow tip never is.
The click squash nobody could see
With shape and clicks logged, the export could draw a little press on every click. The first version shrank the cursor by 14 percent on a click. It looked fine in the code and was invisible in the video, because it lasted less than a frame.
0.4.4 replaced it with a squash you can actually see: wider and shorter for a quarter of a second, with a small settle after.
What I'd tell anyone doing this
- Anything you change system wide, undo on the next launch too. Your exit handler won't run if you crash.
- Exclude your own windows from capture rather than trying to hide them at the right moment, and prove it with a capture, not your eyes.
- Build lookup tables before you change the thing you're looking up.
- Check animations at the frame rate you export. Anything shorter than a frame doesn't exist.
The cursor in Framok today
Framok hides the real cursor while you record and keeps its position, clicks and shape, and you still see a stand in the whole time. The editor then draws it in one of 15 styles, at 40 to 250 percent size, with smoothing for a shaky hand, a ripple and a press on every click, and the arrow turns into a hand or a text beam wherever the real one did.
Where Framok doesn't help
- Only recordings made in Framok. It needs the cursor data it saves while recording, so it can't restyle the cursor in a video from OBS or the Snipping Tool.
- No custom cursor images. You pick from the 15 built in styles.
- Windows only. Windows 10 or 11, 64 bit. A Mac version has a waitlist at the bottom of framok.com.
- The installer isn't code signed yet, so SmartScreen warns the first time. Click More info, then Run anyway.
Framok is $29 once for the life of the product, or $5 a month and cancel any time. Both cover 2 of your own PCs. The download from framok.com is free for 7 days with every feature and no card, and paid licences have a 14 day money back guarantee.
Anyone else drawing their own cursor in a Windows app? I'd love to hear how you handled shapes from apps that bring their own.
Sources
- Microsoft Learn, SetWindowDisplayAffinity, GetCursorInfo, CURSORINFO and LoadCursor
- Electron, BrowserWindow: setContentProtection, setIgnoreMouseEvents, setAlwaysOnTop and the constructor options, plus the current BaseWindow docs for when content protection takes effect
- Framok's changelog (0.2.0, 0.4.1 and 0.4.4), its commits from 5 and 6 Sep 2026 (b679c3b, 63ebe6e, b256a1c and 706443d) and the cursor code in the recorder repo
- My build notes for Qulok, 19 Sep 2026, for the capture probe