According to talks about tray icon indicators, just some idea aloud.
RAM Clear (look at signature below this message) has a feature to show free RAM in the Tray Icon - as a digital indicator in the percentage manner.
It's C(++) code, and, as described in its thread, is not neat, multiple times rewritten/extended without real refactorization to make it greater looking, lol, so won't post the sources there/here.
But the idea was to create a bmp (in memory, GDI), then to draw to it the percentage number with text (like TextOut, in other words, GDI also), then create simple icon with using that bmp, then draw that icon on the taskbar/tray. Remember to calculate in realtime the size of text to fit it into the center/centre of the icon exactly, or predetermine it before an action (to hardcode it) depending on the size of an icon you will make, and the type of font you will use (monospaced fonts are a lot easier to use in this hardcoded way, just use pixel-size when you create it).