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

Multi-threading in an add-in?

This is a discussion on Multi-threading in an add-in? within the Development forums, part of the MapPoint Desktop Discussion category; I know VB6 prohibits it, but has anyone had any luck getting a .NET add-in to multi-thread? My concern is ...

  1. #1
    Winwaed's Avatar
    Winwaed is offline Mapping-Tools.com Black Belt
    Join Date
    Feb 2004
    Location
    Irving,Texas
    Posts
    1,859
    Blog Entries
    60

    Multi-threading in an add-in?

    I know VB6 prohibits it, but has anyone had any luck getting a .NET add-in to multi-thread?

    My concern is to keep a GUI responsive. With VB6 this can be done using "sleep", which puts the current thread into the window/form's message loop for the set period. The closest sleep call in the .NET world literally halts a thread, which is no good.

    Another way might be to force a form to empty the message queue regularly?

    Richard
    Winwaed Software Technology LLC
    http://www.winwaed.com
    See http://www.mapping-tools.com for MapPoint Tools

  2. #2
    Mattys Consulting's Avatar
    Mattys Consulting is offline Senior Member Black Belt
    Join Date
    Dec 2002
    Posts
    1,040

    Re: Multi-threading in an add-in?

    Richard,

    Your pardon please - I don't even own VS7 - but the example here:
    VB Helper: HowTo: Start multiple threads in VB.NET
    shows Thread.Sleep.

    Mike Mattys

  3. #3
    Winwaed's Avatar
    Winwaed is offline Mapping-Tools.com Black Belt
    Join Date
    Feb 2004
    Location
    Irving,Texas
    Posts
    1,859
    Blog Entries
    60

    Re: Multi-threading in an add-in?

    Thanks Mike, yes "Thread.Sleep" is what I was referring to as the equivalent in .NET. The problem is that this literally stops the thread for the specified period of time. I want to "process all messages", so I need a sleep that does that in the background. (VB6's sleep() does this).

    Following your link led me to go back to the online MSDN docs. There I found Thread.Join which does the required message processing BUT it needs to work on a second thread. So far that isn't working for me, and if I create a second thread then I might as well run the entire dialog box in its own thread (which is what I do in standalone apps).

    I'll probably give this a go next, although I know multiple threads in add-ins is prohibited in VB6 and I suspect all add-ins.

    Richard
    Winwaed Software Technology LLC
    http://www.winwaed.com
    See http://www.mapping-tools.com for MapPoint Tools

  4. #4
    Winwaed's Avatar
    Winwaed is offline Mapping-Tools.com Black Belt
    Join Date
    Feb 2004
    Location
    Irving,Texas
    Posts
    1,859
    Blog Entries
    60

    Re: Multi-threading in an add-in?

    My code is a bit messy still, but it looks like multi-threading is working!!

    My approach is to use asynchronous delegates, and you MUST run all MapPoint calls in the add-in's main thread. So my dialog box runs in a second thread as a modal dialog box.


    Richard
    Winwaed Software Technology LLC
    http://www.winwaed.com
    See http://www.mapping-tools.com for MapPoint Tools

  5. #5
    Mattys Consulting's Avatar
    Mattys Consulting is offline Senior Member Black Belt
    Join Date
    Dec 2002
    Posts
    1,040

    Re: Multi-threading in an add-in?

    I was wondering if calling an ActiveX Exe from the addin would work ...
    Anywho, congrats! (what addin are you making now?)

    Mike Mattys

  6. #6
    Winwaed's Avatar
    Winwaed is offline Mapping-Tools.com Black Belt
    Join Date
    Feb 2004
    Location
    Irving,Texas
    Posts
    1,859
    Blog Entries
    60

    Re: Multi-threading in an add-in?

    This is continued development of MPSuperShape. I'm expanding the import options to include .SHP and .MIF files (see my other post elsewhere).

    A customer sent a sample file of about 3Meg - it takes a few minutes to load, so I decided a "Working..." dialog box was required.


    Richard
    Winwaed Software Technology LLC
    http://www.winwaed.com
    See http://www.mapping-tools.com for MapPoint Tools

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Multi-radius
    By Anonymous in forum Wish List
    Replies: 2
    Last Post: 06-30-2003, 12:54 AM
  2. multi polyshape query
    By henemonster in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 03-25-2003, 07:10 PM
  3. Multi-radius
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 02-26-2003, 10:07 AM
  4. [Multi pushpins selection ?]
    By Vincent BENNER in forum MapPoint Desktop Discussion
    Replies: 4
    Last Post: 01-30-2003, 05:41 AM
  5. Mappoint newbie here- need to be able to map multi....
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 06-13-2002, 11:04 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