question

SureshKumarPondicherry-1972 avatar image
0 Votes"
SureshKumarPondicherry-1972 asked RLWA32-6355 commented

ATL containment class for VS 2019

Hello,

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..



c++
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Does the call to AtlAxWinInit return TRUE?

0 Votes 0 ·
RLWA32-6355 avatar image
0 Votes"
RLWA32-6355 answered

Try using AtlAxWin140 as the window class.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

JeanineZhang-MSFT avatar image
0 Votes"
JeanineZhang-MSFT answered RLWA32-6355 commented

Hi,

According to the atldef.h file:

 #define ATLAXWIN_CLASS "AtlAxWin140"

The ATL window class name is "AtlAxWin140" in Visual Studio 2019. I suggest you could try to use AtlAxWin140 instead of AtlAxWin or try to use the ATLAXWIN_CLASS macro instead of _T("AtlAxWin").

And I suggest you could try to use CAxWindow::GetWndClassName to retrieve the name of the window class.

Best Regards,

Jeanine



If the response is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.




· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Duplicate response. The answer to use the windows class AtlAxWin140 was already provided!

0 Votes 0 ·