The error "linkage specification is incompatible with previous "MonitorFromWindow"" in 32 bit build VS10 MCBS is given for the following decl:
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow)
{
HMONITOR MonitorFromWindow(_In_ HWND hwnd, _In_ DWORD dwFlags);
return DialogBoxW(hInstance, MAKEINTRESOURCEW(lpTemplate), nullptr, DlgProc);
}
Assumed the solution would be similar to the one given here, but here it might be some problem with the SDK although some kind of header hack is preferred.
The error is telling you that your declaration of MonitorFromWindow
conflicts with the prior declaration. The prior declaration in Winuser.h
declared the function with extern "C"
linkage, is __declspec(dllimport)
and has the __stdcall
calling convention.
You should remove your erroneous declaration and use that from the header file.