microsoft / microsoft/microsoft-ui-xaml
How can I intercept WM_APPCOMMAND in WinUI 3 for custom navigation?
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 8.4k
- Forks
- 942
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 105
Description
Hello,
I’m working on implementing custom navigation handling in a WinUI 3 app, and I’d like to handle WM_APPCOMMAND messages—specifically for browser navigation keys (e.g., back, forward, home).
However, I’ve noticed that while WM_APPCOMMAND with some commands like APPCOMMAND_BROWSER_HOME make it to my window (so I can handle them in a custom WndProc), others—such as APPCOMMAND_BROWSER_BACKWARD—never reach my handler. It seems like these messages are being filtered or intercepted by the system before I can process them.
Is there any way to gain access to these navigation commands in WinUI 3? I’m hoping to avoid resorting to global keyboard hooks or other invasive solutions if possible.
Has anyone found a workaround, or is this interception by design in the WinUI 3 framework?
Thanks in advance for any pointers!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing WM_APPCOMMAND handling in a WinUI 3 window using the custom WndProc described in the issue, comparing APPCOMMAND_BROWSER_HOME with APPCOMMAND_BROWSER_BACKWARD. Trace where the differing messages are filtered or intercepted; done requires identifying a supported access path or documenting that the behavior is by design.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- desktop, operating-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100