MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




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 2006/2009 Discussion category; I know VB6 prohibits it, but has anyone had any luck getting a .NET add-in to multi-thread? My ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion > Development

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-18-2007
Winwaed's Avatar
Mapping-Tools.com
Red Belt
 
Join Date: Feb 2004
Posts: 742
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
Pre-Order MapPoint 2009 today: http://www.mapping-tools.com/mappoint2009
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 10-19-2007
Senior Member
Blue Belt
 
Join Date: Dec 2002
Posts: 193
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 10-19-2007
Winwaed's Avatar
Mapping-Tools.com
Red Belt
 
Join Date: Feb 2004
Posts: 742
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
Pre-Order MapPoint 2009 today: http://www.mapping-tools.com/mappoint2009
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 10-19-2007
Winwaed's Avatar
Mapping-Tools.com
Red Belt
 
Join Date: Feb 2004
Posts: 742
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
Pre-Order MapPoint 2009 today: http://www.mapping-tools.com/mappoint2009
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 10-19-2007
Senior Member
Blue Belt
 
Join Date: Dec 2002
Posts: 193
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6 (permalink)  
Old 10-20-2007
Winwaed's Avatar
Mapping-Tools.com
Red Belt
 
Join Date: Feb 2004
Posts: 742
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
Pre-Order MapPoint 2009 today: http://www.mapping-tools.com/mappoint2009
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Multi-radius Anonymous Wish List 2 06-29-2003 11:54 PM
multi polyshape query henemonster MapPoint 2006/2009 Discussion 0 03-25-2003 06:10 PM
Multi-radius Anonymous MapPoint 2006/2009 Discussion 1 02-26-2003 09:07 AM
[Multi pushpins selection ?] Vincent BENNER MapPoint 2006/2009 Discussion 4 01-30-2003 04:41 AM
Mappoint newbie here- need to be able to map multi.... Anonymous MapPoint 2006/2009 Discussion 3 06-13-2002 10:04 AM


All times are GMT -5. The time now is 08:13 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5
MP2K Magazine
Visitor Map

Borovets Ski Holidays
Borovets ski holidays are set amongst stunning scenery with a great selection of restaurants, hotels and nightlife. Borovets ski holidays are great value for money.

Travel Agency
We are a Queen's Award winning travel agency here to help with your travel plans.

Flight to Canada
Book a flight to Canada to explore one of the most exciting travel destinations in the world. There are loads of interesting cities but some even more impressive natural beauty.

Sri Lanka Holidays
There are some outstanding deals on Sri Lanka holidays at theholidayplace.co.uk. Sri Lanka is renowned for it's exceptional beauty! Book a holiday today!

Cheap Balearics Holidays
Cheap Balearics holidays are available if you know when to book and who to book with. The Balearics have many fascinating places to visit all year round. The partying never stops.

Bargain family holidays
We can help you find family holidays at bargain prices when you check out the options at Travel.co.uk

Holidays in Portugal
Find the perfect Algarve holiday. Book holidays in Portugal now at On The Beach.


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