PDA

View Full Version : Optimize Progress Bar



Metod
10-24-2005, 07:26 AM
Hi!

Is there a way to show the Optimise progress bar in a VB app, like in Mapppoint 2004 ?
Some times process can be very long, so users can't see if it's still computing or crashed.

Thanks for your answer.

Wilfried
11-04-2005, 11:35 AM
Hi,

Tell your users you write crashFree programs so they dont have to worry :)

Which process you want to show a progress bar for ?

Metod
11-07-2005, 09:27 AM
Hi!
Thank you for your answer !
Well, I think my customers haven't funny taste like us ;)
So here is a copy of what I want to do :
http://img251.imageshack.us/img251/494/mappoint4ye.jpg

Winwaed
11-07-2005, 10:11 AM
I think you have to multi-thread your addin so that the status bar is animated whilst MapPoint is processing.

From what I remember, multi-threaded VB is not allowed for MapPoint add-ins which run "in-process".

I've done some status updates with timers, but I don't think this will work in this case. The timer call will wait until the optimise route has finished!

Richard

Wilfried
11-07-2005, 11:08 AM
Hi,

Richard is right, Mappoint blocks the message pump while it calculate a route. About threading, visual objects are not threadsafe in general, so a form is not.

What is easy to do is spamn another application that only display the form in the center of the form of the map with a progress bar. The calculated time may be a gues, but you can experiment a little and let the program guess it depending on the amount of stops. Should be more or less OK.

So you launch the application in your code before calculating route, and when it is calculated you post a WM_QUIT message to that application which will then exit. Your form (with mappoint) will not have focus because message pump is blocked, so progressbar will stay visible.

Maybe better ideas but this is the best I can come up with at the moment..

Winwaed
11-07-2005, 11:31 AM
Wilfried: That's a good idea. Could be fiddly in VB, but it is essentially "coarse grained" threading. :-)



Richard

Metod
11-07-2005, 11:39 AM
ok, thank you!

Finally I think the crashfree statement is the best solution ;)

Joel
11-08-2005, 12:14 PM
Here's what I use in C# which does exactly what you want

SendMessage(FindWindow(null, "Map - Microsoft MapPoint North America"), WM_COMMAND, 35388, 0);

Needs SendMessage imported from User.dll

Doesn't anyone here use Spy++ any more?

Joel

Wilfried
11-08-2005, 12:52 PM
Hi Joel,

He does not need to import since he use VB (not dotNet) so he can just call the win32 API. However, can you explain what you do ?

I understeand the WM_COMMAND message. It is sent when accelarator key's are used or when menu item is selected. But where do you get the WParam value from ? I know it is notif code and ident but how do you know both of the values ?

Maybe I have to check Spy++ as you mention. What is URL of it?

Wilfried
11-08-2005, 12:56 PM
Hi,


Finally I think the crashfree statement is the best solution

Whell it is the most professional answer you can give to a customar. The strange thing is that they always beleive it 8) Also you can raise the invoice without test period !!!

Wilfried
11-08-2005, 01:23 PM
Hi Richard,


Could be fiddly in VB

Dont understeand the word "fiddly". ?
Looked up google but the translation engine could not translate it :(

Winwaed
11-08-2005, 03:35 PM
Probably because it is speaking with a Californ-E-A accent :-)


My free-with-Shredded-Wheat Collins English English dictionary says "awkward to do or use".

Eg. Threading a needle can be fiddly.


VB is great for things like quick form design, quick COM->MapPoint (etc) writing, but it always seems a bit high level for the things that C/C++ is suited.


Richard

Joel
11-14-2005, 04:00 PM
Hi Wilfried, sorry I'm slow in responding. I don't visit too often these days. But I have visited for years, from back in the days when this was posted

http://www.mp2kmag.com/articles.asp?ArticleID=88&key=ActiveX.MapPoint.extend

It will explain about using Spy++ (which comes with Visual Studio) to extend MapPoint, better than I can.

A warning though, from personal experience... There seems to be a reason that some features from MapPoint are not offered through methods in the ActiveX control. Some features don't work quite right if you call them from the ActiveX control (using the PostMessage method). But the optimize with the dialog seems to work great from my experience.

Joel


Hi Joel,

He does not need to import since he use VB (not dotNet) so he can just call the win32 API. However, can you explain what you do ?

I understeand the WM_COMMAND message. It is sent when accelarator key's are used or when menu item is selected. But where do you get the WParam value from ? I know it is notif code and ident but how do you know both of the values ?

Maybe I have to check Spy++ as you mention. What is URL of it?

Wilfried
11-15-2005, 01:43 PM
Thanks Joel,I will look into it. I should have Spy without knowing because I have VS2005 :)

Joel
11-16-2005, 01:08 PM
Thanks Joel,I will look into it. I should have Spy without knowing because I have VS2005 :)

Unfortunately I doubt it. VS 2003 doesn't ship with it. I still maintain some legacy code, so I have VS 6 which has it.

Joel

Wilfried
11-16-2005, 01:13 PM
Hi,

You right. VS2005 beta2 (witch I have) does not seems to have it. Just got VS2005 standard (not beta), but not yet installed, probably same thing :(

Thanks for help anyway :)