# Struggling in using MapWinGIS in ATL/WTL application

**URL:** <https://mapwindow.discourse.group/t/struggling-in-using-mapwingis-in-atl-wtl-application/497>\
**Category:** MapWinGIS\
**Created:** [March 19, 2020, 12:17am UTC](https://mapwindow.discourse.group/t/struggling-in-using-mapwingis-in-atl-wtl-application/497 "2020-03-19T00:17:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![steveha](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@steveha](https://mapwindow.discourse.group/u/steveha)\
**Post date:** [March 19, 2020, 12:17am UTC](https://mapwindow.discourse.group/t/struggling-in-using-mapwingis-in-atl-wtl-application/497/1 "2020-03-19T00:17:33Z")

</div>

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)](https://global.discourse-cdn.com/free1/uploads/mapwindow1/original/1X/58bf815da9b6b3baa2985072093749032adff64e.png)

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.

---

<div class="post-metadata">

**Author:** ![jerryfaust](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/jerryfaust/32/378_2.png) [@jerryfaust](https://mapwindow.discourse.group/u/jerryfaust)\
**Post date:** [March 19, 2020, 2:48am UTC](https://mapwindow.discourse.group/t/struggling-in-using-mapwingis-in-atl-wtl-application/497/2 "2020-03-19T02:48:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![pmeems](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/pmeems/32/9_2.png) [@pmeems](https://mapwindow.discourse.group/u/pmeems)\
**Post date:** [January 5, 2022, 3:09pm UTC](https://mapwindow.discourse.group/t/struggling-in-using-mapwingis-in-atl-wtl-application/497/3 "2022-01-05T15:09:00Z")

</div>

Closed on January 5, 2022, 3:09pm UTC


