MFC: _AFXWIN_INLINE give me “no overloaded function takes 6 arguments”

心不动则不痛 提交于 2020-12-16 07:01:44

问题


In an MFC application I am trying to move a console window I have added for debug purposes.

    /*  Put here just for reference
        _AFXWIN_INLINE void CWnd::MoveWindow(LPCRECT lpRect, BOOL bRepaint)
        { MoveWindow(lpRect->left, lpRect->top, lpRect->right - lpRect->left,
        lpRect->bottom - lpRect->top, bRepaint); }
    */
        HANDLE hh;
        bool oo = CWnd::MoveWindow( hh, 100, 0, 300, 300, true );

I get this error:

Error   C2661   'CWnd::MoveWindow': no overloaded function takes 6 arguments    
G:\proj\repos\EnterDG\EnterDGDlg.cpp    201

The strange thing is that if I put the mouse pointer at the "MoveWindow"" I get the expected prototype. But if I use "goto definition" I get the definition you see in the first lines( greyed out ).

I have tried to "#undef _AFXWIN_INLINE"


回答1:


CWnd::MoveWindow has two overloads, one taking 5 arguments, the other taking 2 arguments. As the error indicates, there is no overload that takes 6 arguments.

It looks like you are trying to call the Windows API function MoveWindow instead. This is a free function, so you need to drop the CWnd:: scope resolution. Using a global namespace resolution prefix is always safe, e.g.: ::MoveWindow(...);.



来源:https://stackoverflow.com/questions/65019387/mfc-afxwin-inline-give-me-no-overloaded-function-takes-6-arguments

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