Through much pain and suffering, I have gotten proper icon support going on Windows.
Getting bitmap output to work properly carried a lot of nuances. Eventually, I decided to break it out into a new BMP.encode
method in Lime, so this is now usable by other projects that would like to use bitmap format encoding as well 
I ended up implementing three different forms of bitmaps, the standard RGB that only displays color and no alpha, also BITFIELD which does support alpha but (surprise surprise!) this format of bitmap is not support by the Windows icon format. There’s a severe lack of documentation out there 
I also added a special ICO format for bitmap, which has a special AND mask – though I could not get that to work correctly. The AND mask we had before was broken, ultimately it was the cause of the black image. Most variations of AND masks I used either resulted in Windows automatically using it’s own estimation (which caused some bad artifacts on the Lime icon) or one that worked perfect, except for some vertical lines. Someone who is knowledgable might tweak the AND mask and find a way to get it to work. This would be most useful for old systems, like Windows XP, or even before, so this might not be an issue. Ultimately, I find that including a blank AND mask seemed to result in Windows respecting the alpha pixel values in the bitmap, and magically, it seems to work perfectly, or look perfect, even though I know it’s not quite kosher.
By the way, if anyone works on this, the Windows icon cache is a pain to clear. I use Windows 10, and it never worked for me. My trick was to rename my executable each time I published (such as “MyApplication.exe” and “_MyApplication.exe”) and not to delete so I was sure I had not used the name before. Crude, but eventually I got it 
I’m very glad to see that the “ReplaceVistaIcon.exe” tool that we use to push in the icon is working correctly, once you have an icon file that’s truly proper. Oh, I also made the 256x256 icon a PNG instead of a bitmap, so that should save on the file size and make it the way Windows really expects.
I’m also happy to report that I found how I can control the resource ID of the embedded icon, as well as making the created SDL window respect and use the embedded icon. Now I am not using setIcon
to set it at runtime, but instead it will respect the same ICO file that’s within the EXE. This is ideal, because no single icon PNG really matches all the icon sizes Windows asks for. Now Windows should be able to pull the exact size it wants, so your icon looks proper in all situations.
Lastly, “ReplaceVistaIcon.exe” failed before using Neko (it broke the executable), but I worked around it, so Neko as well as C++ have the icon.
It was quite the crusade, but I’m happy to report that we’ve all come out as the victors. This shouldn’t be something we need to change, so expect proper Windows icons from now on 