Struggling in using MapWinGIS in ATL/WTL application

Hi everyone,

I am using a prebuilt MapWinGIS-5.1.1-x32/x64-VS2017
and I have VS2019 16.5.

The trouble I encoutered like this:

  • MapWinGIS activeX works well in a C# program.

  • MapWinGIS activeX is successfully embedded into a dialog of a ATL/WTL C++ program,
    and I test in resource editor fine (Ctrl + T), the activeX map is displayed well.

TestOk(Ctrl T)

but when I run the progam, it crashes. It crashes in both x32 and x64 platforms.
The crash point locates in atlhost.h

// IOleInPlaceSiteEx
STDMETHOD(OnInPlaceActivateEx)(
	_In_opt_ BOOL* /*pfNoRedraw*/,
	DWORD dwFlags) {

	...	
	
	if (m_spInPlaceObjectWindowless)
		m_spInPlaceObjectWindowless->SetObjectRects(&m_rcPos, &m_rcPos); <-- crashes at this point.
	return S_OK;
}

Is there anyone integrating MapWinGIS to a ATL/WTL or a C++ program successfully?
I would like to get an advice to overcome the issue.

Hello @steveha.

I have created an MFC dialog-based application in the past, and it worked well. Of course, an MFC app has some ATL integrated, but I did not create an ATL app - it was MFC-based. And I confess that I don’t know anything about WTL, so I can’t speak to that.

I will try to write up a little bit about the process I went through to create the app. Hopefully that will help.

Kind Regards,
Jerry.