Am using CreateWindow() API which was working correctly on VS2015 before upgrading to VS2019. After upgrading to VS2015 CreateWindow API is returning null HWND. Calling AtlAxWinInit() before CreateWindow() API as shown below:
CreateControl()
{
AtlAxWinInit();
HWND hwndChild = CreateWindow(_T("AtlAxWin"),
_T("test"),
WS_CHILD|WS_VISIBLE,
0,0,0,0,
hwnd,NULL,
::GetModuleHandle(NULL),
NULL);
}
GetLastError() is returning 1407 error code which is ERROR_CANNOT_FIND_WND_CLASS:
Cannot find window class.
Could you please help me to resolve this..
Thanks..
The ATL window class name was changed in the different versions of Visual Studio. It is "
AtlAxWin140" for VS 2019.The
atldef.hfile defines the current version of the windows class name in the following macro:ATLAXWIN_CLASSYou should use the
ATLAXWIN_CLASSmacro instead of _T("AtlAxWin").