Sluggish refresh on startup

208_Fireball
01-29-2008, 08:52 PM
Hi All,

I've been experiencing a problem where *sometimes*, the MapPoint control seems to not draw itself, or only perform a partial draw (say the Microsoft logo with no map.)

Has anyone else seen this and/or come up with graceful ways to detect and invalidate in this situation?

I created a bare-bones test application, which is a Visual Studio 6.0 C++ MFC dialog with the statically linked mfc dll. It includes the OnUIDeactivate fix from these forums ( http://www.mapforums.com/map-point-activex-mfc-view-mdi-application-2661.html ), opens a new US map, and that's it.
The test application exhibits the problem.
I've attached the whole test source, including exes, but not the intermediate source (for size reasons) if anyone is interested. *You'll need MapPoint North America installed before you run the application.* Also, I've included a sample image of a good startup window (includes map), and one of a bad startup window (no map.)

Cheers,

Dave

Mattys Consulting
01-31-2008, 07:21 PM
Hi Dave,

Yep, I have that problem. I used UpdateWindow on the whole heirarchy
and SetFocus, as well. No solution so far. I'll figure it out eventually ...

Mike Mattys

208_Fireball
02-01-2008, 01:31 AM
It's both good and bad that you share my pain!

Invalidate(TRUE) on the main dialog seems to be able to recreate the refresh problem every time.

I wonder if we can override OnEraseBkgnd in the Generated Mappoint control class, and do something there to fix it? (Providing the file's backed up, in case Studio regenerates the file.)

Cheers,

DaveH

208_Fireball
02-03-2008, 05:07 PM
Well, if you find the actual map window of the MapPoint control (by using Spy++ or similar), and send it an Invalidate(FALSE) in the MapPoint control's OnEraseBkgnd function, before the call to the base CWnd::OnEraseBkgnd(pDC), it seems to fix the refresh - with no side effects noticed (so far.)

Cheers,

Dave

208_Fireball
02-03-2008, 05:15 PM
Also,

Edit: Note that MapPoint 2006's internal map window is in a different location to that of 2002 and 2004.

Here's my simple code, generated after using Spy++ :

if (nVersion == 13) {
hwndMapCtrlHandle = FindWindowEx((HWND) *pWndChild,0,"AfxFrameOrView70", NULL);
hwndMapCtrlHandle = FindWindowEx(hwndMapCtrlHandle,0,"AFX:00400000:8",NULL);
hwndMapCtrlHandle = FindWindowEx(hwndMapCtrlHandle,0,"AFX:00400000:8",NULL);
hwndMapCtrlHandle = FindWindowEx(hwndMapCtrlHandle,0,"AFX:00400000:8",NULL);
hwndMapCtrlHandle = FindWindowEx(hwndMapCtrlHandle,0,"AFX:00400000:8",NULL);
hwndMapCtrlHandle = FindWindowEx(hwndMapCtrlHandle,0,"AFX:00400000:8",NULL);
hwndMapCtrlHandle = FindWindowEx(hwndMapCtrlHandle,0,"AFX:00400000:8",NULL);
hwndMapCtrlHandle = FindWindowEx(hwndMapCtrlHandle,0,"AFX:00400000:8",NULL);
hwndMapCtrlHandle = FindWindowEx(hwndMapCtrlHandle,0,"AfxWnd70","Map Control");
} else if ((nVersion == 11) || (nVersion == 9)) {
hwndMapCtrlHandle = FindWindowEx((HWND) *pWndChild,0,"AfxFrameOrView42", NULL);
hwndMapCtrlHandle = FindWindowEx(hwndMapCtrlHandle,0,"AFX:400000:8",NULL);
hwndMapCtrlHandle = FindWindowEx(hwndMapCtrlHandle,0,"AFX:400000:8",NULL);
hwndMapCtrlHandle = FindWindowEx(hwndMapCtrlHandle,0,"AFX:400000:8",NULL);
hwndMapCtrlHandle = FindWindowEx(hwndMapCtrlHandle,0,"AFX:400000:8",NULL);
hwndMapCtrlHandle = FindWindowEx(hwndMapCtrlHandle,0,"AFX:400000:8",NULL);
hwndMapCtrlHandle = FindWindowEx(hwndMapCtrlHandle,0,"AFX:400000:8",NULL);
hwndMapCtrlHandle = FindWindowEx(hwndMapCtrlHandle,0,"AfxWnd42","Map Control");
}


Please let me know if this has been of use to any of you!

Cheers,

Dave

 
Web mp2kmag.com
mapforums.com