It looks like the issue comes from defining STRICT. I looked to win16.h header, which declares HWND, the header checks for STRICT which I defined in test.cpp. If STRICT is not defined, HWND is declared as UINT. But if defined, HWND is declared as structure.
For solution, I added "#define STRICT" to test2.cpp.