Skip to content

Open Source

CustomMenu

A custom drawn popup menu in pure C, using only Win32 and GDI. No default Windows menus.

Install

git clone https://github.com/AmashOnBlitz/CustomMenu

I made this to learn how Win32 works under the hood. Instead of using the normal Windows menu, I draw the menu myself, the text, the borders and the hover effect, all with GDI and WM_PAINT. It is written in plain C with no framework.

It is finished. It was a learning project, so I am not planning to add more to it.

What it has

  • A menu bar and a popup menu, both drawn by hand
  • Hover effects on the items
  • A small hover box
  • A demo window in main.c that shows the menu

The popup is created with one function:

HWND fnCreateMenuPopUp(POINT p, int WidthFactor, PopupMenuItemStructArray* PMISA);

You give it a position, a width and the list of items.

Build it

You need Windows and gcc (MinGW). compile.bat builds everything and runs it:

gcc helpers.c CustomMenu.c main.c hoverBox.c MenuPopUp.c -o CustomMenu -lgdi32

Notes

  • Windows only.
  • Learning project, so the code is not polished and there is no support.
  • MIT licensed. Take whatever is useful.