Great stuff! What were the final commands you used?

Assuming you mean how can you get an icon using pure C++ code without any resources: You can't. Resources can be made programmatically and there is support in the WinAPI for that, but the way Windows draws an icon is by looking in the executable for icon resources. If you want to animate an icon like the way AVG modifies its tray icon, or the way Privoxy does the radar thing when loading a page, etc, then you do that with multiple icon resources and specify at runtime which resource is the current system tray icon or whatever.