Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 5 of 5

Access Violation

This is a discussion on Access Violation within the MapPoint Desktop Discussion forums, part of the Map Forums category; I have a vc++ dialog app with dialogs in a tab control. One of the dialogs has the mappoint control ...

  1. #1
    dcarl is offline Junior Member White Belt
    Join Date
    Feb 2003
    Posts
    3

    Access Violation

    I have a vc++ dialog app with dialogs in a tab control. One of the dialogs has the mappoint control in it. When I try to call m_mappointcontrol->NewMap(northamerica) I get an access violation. I can only call the NewMap from a button on the actual dialog with the mappoint control.

    Have you seen this behavior? Has anyone found a solution?

    thanks in advance

  2. #2
    discostu is offline Junior Member White Belt
    Join Date
    May 2005
    Posts
    9

    NewMap access violation

    I, too, get an access violation after I create a NewMap in my application. I made it so that when my app starts up, the MappointCtrl is hidden and there is a CListCtrl shown in the same place. I have a button that shows the MappointCtrl and hides the CListCtrl. The map shows up fine. And the first time I run the application after doing a "Rebuild All" it runs fine. But every time I run it after that I get an Access Violation and it shows me the dissassembly (which doesn't really help me figure out what's going on).

    Code:
    void CMainFrame::OnMapView( ) {
    	CRouteProgressView* pRPV   = NULL;
    	CRoadRunnerMobileApp* pApp = (CRoadRunnerMobileApp*)AfxGetApp();
    
    	if (pApp != NULL)
    		pRPV = pApp->pProgressView; // pointer to the dialog class with the controls
    	else
    		return;
    
    	CListCtrl     *list = pRPV->getListCtrl();
    	CMappointCtrl *map  = pRPV->getMapCtrl();
    
    	if( !map->IsWindowVisible() ) {
    		list->ShowWindow( SW_HIDE );	
    		map->ShowWindow( SW_SHOW );
    		map->SetActiveWindow();
    		pRPV->createNewMap();
    	} else {
    		map->CloseMap();
    		list->ShowWindow( SW_SHOW );	
    		map->ShowWindow( SW_HIDE );
    	}
    
    }
    
    --------------------------------
    class CRouteProgressView : public CFormView
    {
    ...
    	CMappointCtrl* getMapCtrl()  { return &m_Map; };
    	CListCtrl*     getListCtrl() { return &m_List; };
    	void createNewMap() {
    		VARIANT a;
    		a.vt = VT_I4;
    		a.lVal = 1; // 1 for America 2 for geoMapEurope!
    		m_Map.NewMap(a);
    	};
    ...}
    Any ideas? Thanks!

  3. #3
    dcarl is offline Junior Member White Belt
    Join Date
    Feb 2003
    Posts
    3

    access violation, NewMap

    The interface changes in the .net ide aka (vc++7.0) and fixes this.

  4. #4
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433

    Re: Access Violation

    Hi,

    Quote Originally Posted by dcarl
    I have a vc++ dialog app with dialogs in a tab control. One of the dialogs has the mappoint control in it. When I try to call m_mappointcontrol->NewMap(northamerica) I get an access violation. I can only call the NewMap from a button on the actual dialog with the mappoint control.
    You mean the dialog is created but not visible ? Yes, if that's the case you must show it (modal or not), then load the map and eventually hide it if you want. If you dont want to have the map visible for a moment you can make it zero pixels height/width, or put another control above it.

  5. #5
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433

    Re: NewMap access violation

    Hi,

    Quote Originally Posted by discostu
    the first time I run the application after doing a "Rebuild All" it runs fine. But every time I run it after that I get an Access Violation
    There is no difference between the first run after a rebuild and supsequent runt, however it is possible that you still have a mappoint instance running in memory for a while, if your application does not do a nice cleanup for some reason.

    Eventually check with task manager, or make a small application that remove all mappoint instances out of memory before a second run to see if that is the reason.

    To remove all mappoint instances there is example of it in FAQ.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96