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 4 of 4

BeforeClick event cancel not working with VC++

This is a discussion on BeforeClick event cancel not working with VC++ within the MapPoint Desktop Discussion forums, part of the Map Forums category; When using a MapPoint 2006 control in a VC++ MFC dialog application, setting the Cancel output argument seems to have ...

  1. #1
    mayfly is offline Junior Member White Belt
    Join Date
    May 2007
    Posts
    2

    Question BeforeClick event cancel not working with VC++

    When using a MapPoint 2006 control in a VC++ MFC dialog application, setting the Cancel output argument seems to have no effect for me.

    The relevant code is:

    .h ...

    afx_msg void OnBeforeClickMap(long Button, long Shift, long X, long Y, BOOL FAR* Cancel);
    DECLARE_EVENTSINK_MAP()
    //}}AFX_MSG

    .cpp ...

    BEGIN_EVENTSINK_MAP(MainDialog, CDialog)
    //{{AFX_EVENTSINK_MAP(MainDialog)
    ON_EVENT(MainDialog, IDC_MAP_CONTROL, 209 /* BeforeClick */, OnBeforeClickMap, VTS_I4 VTS_I4 VTS_I4 VTS_I4 VTS_PBOOL)
    //}}AFX_EVENTSINK_MAP
    END_EVENTSINK_MAP()

    void TestDialog::OnBeforeClickMap(long Button, long Shift, long X, long Y, BOOL FAR* Cancel)
    {
    *Cancel = TRUE;
    }

    The callback is entered OK, with Button, Shift, X and Y as expected and *Cancel FALSE, but the control is still responding to the click events.

    Judging from other posts, this obviously works with VB and C# etc. Does anyone know why it should be a problem with VC++ (6)?

    Thanks.

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

    Re: BeforeClick event cancel not working with VC++

    It is first time that I see this question. But eventually try to set it to 1 or to -1 (or 0xffffffff). I have seen already bugs like that among programming languages.

  3. #3
    mayfly is offline Junior Member White Belt
    Join Date
    May 2007
    Posts
    2

    Thumbs up Re: BeforeClick event cancel not working with VC++

    Thankyou Wilfried,

    In hindsight, there was an earlier post on the web answering the question.

    MP2K Magazine :: View topic - Canceling mouse clicks in C++

    It is a pity that Microsoft provides very liitle information about accessing this control from C++.

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

    Re: BeforeClick event cancel not working with VC++

    Hi,

    Glad to hear it works. So it is a WORD value. Theoretially null is False and everything else should evaluate to True but that is not the point in various programming languages. Even in same language you can have versions that behave different.

    The -1 should normally work also because if it is a WORD value then it convert to 0xFFFF and if it is a DWORD then it would evaluate to 0xFFFFFFFF.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. VB6 Com Add-In Not Working on Vista
    By dmaestro22 in forum MapPoint Desktop Discussion
    Replies: 6
    Last Post: 02-11-2012, 04:40 PM
  2. beforeclick event
    By mmartin in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 04-13-2007, 07:36 AM
  3. Cancel MapPoint Quit
    By revelashon in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 06-09-2006, 05:20 PM
  4. Cancel Mouse Buttons in Mappoint using VB.NET
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 02-27-2004, 06:20 AM
  5. plz help me : working on GPS system
    By shami in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 07-17-2003, 06:20 AM

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