Yes, it won't work in Windows 10.
replace #pragma lib "user32.lib"
with #pragma comment(lib, "user32.lib")
/Ze is for PellesC msvc compability mode
EDIT: for Windows 10#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#pragma comment(lib, "user32.lib") // LoadIcon
int main(int argc, char **argv)
{
HWND hWnd = GetConsoleWindow();
HICON hIcon = LoadIcon(0, IDI_EXCLAMATION);
SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)hIcon);
// SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
return 0;
}