What set's the nShowCmd parameter of WinMain?

c++, windows, winmain

Solution

In most cases - it does explorer:

Problem

This seems a little strange that i can't find anything about it, but what actually sets the nShowCmd parameter of WinMain? I know what it does, and i know i can set it for windows I create, but when my program starts execution in WinMain, how is the nShowCmd value being set? What actually sets it?

Original source