The icon is only really needed when you want to tell OS what do paint to represent your application be the means of OS. Therefore, it has a transparency feature and a feature which helps you to pack several different bitmaps in one icon object. Reportedly, Windows uses the following set of sizes:
256 x 256 pixels - 32bit (24bit colour, 8bit transparency)
48 x 48 pixels - 32bit (24bit colour, 8bit transparency)
32 x 32 pixels - 32bit (24bit colour, 8bit transparency)
16 x 16 pixels - 32bit (24bit colour, 8bit transparency)
The thing is:
this is the OS which "decide" what size is to be used in every situation. You should only provide a set of bitmaps in an icon object: the "application icon" is put to application executable module resource and will be used by the OS Shell in the UI like Shell-based file managers, standard file dialog boxes and the like. Also, you should use some icons as the window icons; then the OS will show these icons in desktops, track bars and the like. In all cases, the Shell "decides" what to show and how to show.
And I don't see a reason to use icons "inside" the application windows. You should rather use any other kinds of vector or pixel graphics: render graphics directly in controls, use bitmaps…
—SA