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

SelectionChange(NewSelection,OldSelection) in VC++

This is a discussion on SelectionChange(NewSelection,OldSelection) in VC++ within the MapPoint Desktop Discussion forums, part of the Map Forums category; I thaught this thread wasn't necessary, but after reading some articles here, I finally decided to open a new thread ...

  1. #1
    VC_Man is offline Member Green Belt
    Join Date
    Nov 2006
    Posts
    93

    SelectionChange(NewSelection,OldSelection) in VC++

    I thaught this thread wasn't necessary, but after reading some articles here, I finally decided to open a new thread anyway.

    I've read this forum: Catch mappoint events using C++ (without MFC...)

    But still have one problem and that is:

    Code:
    OnSelectionChangeControlMap(LPDISPATCH pNewSelection, LPDISPATCH pOldSelection) 
    {
        //HRESULT hr = pNewSelection->QueryInterface(__uuidof(Pushpin), 
    
        // Get old selection - if it is a pushpin, hide the notes/caption
        if (pOldSelection)
        {
            CPushpin *pOldPin;
            HRESULT hr = pOldSelection->QueryInterface( __uuidof(CPushpin)  , (void**)&pOldPin);
            if (SUCCEEDED(hr))
            {
                //some codeprocessing
            }
        }
    
        // Get new selection - if it is a pushpin, display notes/caption and modify it    
        if (pNewSelection)
        {
            CPushpin *pNewPin;
            HRESULT hr = pNewSelection->QueryInterface( __uuidof(CPushpin)  , (void**)&pNewPin);
            if (SUCCEEDED(hr))
            {
                //some coding
                //some coding agian ;)
            }
        }
    
    }
    and the compilor-error is:
    Code:
     'CPushpin' : no GUID has been associated with this object
     'CPushpin' : no GUID has been associated with this object
    In the forum I've read, they used Pushpin instead of CPushpin.
    I also tried with 'Pushpin', but it didn't matter.
    So does someone know how to get the right GUID of Pushpin?? I'm not a specialist in COM, only understand what's going on a little.
    Last edited by VC_Man; 01-03-2007 at 10:56 AM.

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

    Re: SelectionChange(NewSelection,OldSelection) in VC++

    Hi,

    I assume you have to find it in some #include file. But I never worked with MapPoint in VC++, so someone else has to drop in here.

  3. #3
    VC_Man is offline Member Green Belt
    Join Date
    Nov 2006
    Posts
    93

    Re: SelectionChange(NewSelection,OldSelection) in VC++

    I've solved the problem, maybe someone else can use it too!
    Wtih __uuidof(GUID), this function needs some reference to find out what the GUID is. In Google you can find what GUID is (is a unique ID for a com-object or interface ID of an object: GlobalUniqueIDentifier). Anyway, in my previous snippet of code it needs the ID of Pushpin object.

    What I did was give the function __uuidof() the parameter of the class CPushpin, or an instance of CPushpin. But CPushpin has a member pointer to a Dispatch of the Pushpin COM object. Actually, CPushpin is a wrapperclass of Pushpin COM object, I mean in C++/VC++. So you need the member CPushpin::m_lpDispatch to get to the interfaces of Pushpin COM object.


    Anyway, the result is: __uuidof(Pushpin::m_lpDispatch)

    Good luck!
    Btw, thanks Wilfried

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

    Re: SelectionChange(NewSelection,OldSelection) in VC++

    Hi,

    Thank you also for feedback as this for sure benefit others.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. SelectionChange Event
    By calv1ns in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 10-12-2006, 01:55 PM
  2. SelectionChange event
    By Yazzy in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 05-16-2006, 10:25 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 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