Here's the smallest Windows GUI executable that I was able to compile with MS VC6. It's only 496 bytes large and it doesn't produce any visible output. Nonetheless it does load in memory and it does fulfill its only purpose, which is to return a zero exit code to the system.
Not sure though if it's compilable with any later version of MS Visual C.
#include <windows.h>
// Make section alignment really small
#pragma comment(linker, "/FILEALIGN:16")
#pragma comment(linker, "/ALIGN:16")
// Merge sections
#pragma comment(linker, "/MERGE:.rdata=.data")
#pragma comment(linker, "/MERGE:.text=.data")
#pragma comment(linker, "/MERGE:.reloc=.data")
// Favour small code
#pragma optimize("gsy", on)
// Single entrypoint
int WinMainCRTStartup()
{
return 0;
}
.