Windows7.1 SDK: C2373: “MonitorFromWindow” Redefinition

佐手、 提交于 2019-12-26 12:29:10

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/35720852/windows7-1-sdk-c2373-monitorfromwindow-redefinition

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!