MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Writing files in a VB Addin?

This is a discussion on Writing files in a VB Addin? within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Sounds strange, but I'm having a lot of trouble writing to text files from a VB6 add-in. This is with ...


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

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack (7) Thread Tools Display Modes
  7 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 01-04-2007
Winwaed's Avatar
Mapping-Tools.com
Red Belt
 
Join Date: Feb 2004
Posts: 899
Blog Entries: 10
Writing files in a VB Addin?

Sounds strange, but I'm having a lot of trouble writing to text files from a VB6 add-in. This is with MapPoint 2006, although I've also tried MP2004.

The problem is occasional, but sufficiently common that if I'm writing a hundred lines of text then it will occur in either the first 'run' of my add-in or a re-run.

MapPoint 2006 itself appears to give the problem, and I get the XP message about reporting information to Microsoft. I've tried trapping errors in my file writing code - no luck.

I've tried commenting a lot of the code out so that only an open# and close# occur - still have the crashes!
(commenting ALL the file code fixes the problem, as does exporting to Excel)

I was initially using the "old school Basic" open# and close#, but also tried the modern FileSystemObject/TextStream api. This also gave the same problem.

Thinking back, I think this might be the only VB6 addin that I've written for MapPoint that writes to a text file! All the others usually write to Access or Excel via their COM interfaces.
So I checked the help file incase I missed something - a known restriction (like the non-modal dialog boxes). Can't see anything. Searches on Google and these forums also come up blank.

Is it really the case that writing to a text file in VB6 in a MapPoint addin is unreliable?

I guess a workaround would be write a C++ COM program that did the file writing and call this in a similar way as Excel.

Or I could just drop the text file output options from this add-in...

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 01-05-2007
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
Re: Writing files in a VB Addin?

Hi Richard,

I did never write an add-in. But it's just a DLL called yes ? Maybe you can try to see if you have same problem if called from another program you write. Also then you can step trought te code.

Hope this make sence because so sayd I never wrote an add in...

It sound very strange to me there should be something wrong with writing to disk. What is the error you get ? Can you trap it ?
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 01-05-2007
Winwaed's Avatar
Mapping-Tools.com
Red Belt
 
Join Date: Feb 2004
Posts: 899
Blog Entries: 10
Re: Writing files in a VB Addin?

I get the standard XP "MapPoint has a problem" error with options to pass to the info to Microsoft.

I tried running it in the debugger, but then it works of course!


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 01-06-2007
Winwaed's Avatar
Mapping-Tools.com
Red Belt
 
Join Date: Feb 2004
Posts: 899
Blog Entries: 10
Re: Writing files in a VB Addin?

It looks like the route finding is important.

Ie. writing files & route finding.
Disable the route finding, and it runs okay.

I'd already tried "open,write,close" in one short sequence rather than keeping the file(s) open for a long period, so it isn't the fact that the file is open when a route is calculated.

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 01-08-2007
Senior Member
Green Belt
 
Join Date: Sep 2005
Location: Marshall, Michigan
Posts: 126
Smile Re: Writing files in a VB Addin?

Sounds like it could well be a filehandle allocation problem.
A lot of old COM code used constants when allocating filehandles. You might try assigning filehandles using freefile() and then adding 100 or something similar.

HTH
Paul
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 01-09-2007
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
Re: Writing files in a VB Addin?

Richard, are you sure it has nothing to do with a global variable ? Do you have all local (stack) ? I have no idea, but just write what comes trough my one braincell
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7 (permalink)  
Old 01-10-2007
Winwaed's Avatar
Mapping-Tools.com
Red Belt
 
Join Date: Feb 2004
Posts: 899
Blog Entries: 10
Re: Writing files in a VB Addin?

I've been using freefile.
Freefile+100? I could try it.

If this worked, it would mean that MapPoint (running under XP only) has hard-coded file handle?

A potential customer has a log from MapPoint, and it looks like an internal buffer overflow. Really strange!

Wilfried: I know you're guessing, but I've had similar thoughts elsewhere. This is VB6 so there are a lot of globals (VB6's concept of object oriented programming is not qute 'fully formed'). However I've been converting them to Private (yes I was sloppy with lots of public vars). No luck so far.


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
  #8 (permalink)  
Old 01-25-2007
Winwaed's Avatar
Mapping-Tools.com
Red Belt
 
Join Date: Feb 2004
Posts: 899
Blog Entries: 10
Re: Writing files in a VB Addin?

Just an update before I forget (again!) - the Freefile+100 didn't work.
I'm pulling the text file functionality out...

I don't like doing this, but to make up, I'm also adding support for Excel 2007's extra-large spreadsheets.

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

Tags
addin, files, writing


LinkBacks (?)
LinkBack to this Thread: http://www.mapforums.com/writing-files-vb-addin-5560.html

Posted By For Type Date
Addin | sitetofind.info This thread Refback 02-13-2007 12:28 PM
Add-On Products for MapPoint 2000 - MapPoint Articles - MP2K Magazine This thread Refback 01-16-2007 06:04 PM
What's New in Streets and Trips 2006 - MapPoint Articles - MP2K Magazine This thread Refback 01-08-2007 07:15 PM
An API to Control MapPoint 2006 GPS Features - Part I of II - MapPoint Articles - MP2K Magazine This thread Refback 01-08-2007 05:04 PM
MapPoint Download - MP2K Magazine This thread Refback 01-06-2007 10:20 PM
Map Visitors - Powered by Virtual Earth This thread Refback 01-06-2007 10:12 PM
The Magazine for MapPoint - MP2K Magazine This thread Refback 01-05-2007 05:33 PM

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
HOW TO: MP addin using .NET Labtek MapPoint 2006/2009 Discussion 10 12-14-2004 02:37 PM
C# AddIn Anonymous MapPoint 2006/2009 Discussion 0 12-20-2003 07:44 PM
Writing a new COM component for MapPoint2002 tanguy_laverdure MapPoint 2006/2009 Discussion 0 12-04-2003 03:03 AM
COM AddIn in C++/ATL Anonymous MapPoint 2006/2009 Discussion 3 10-22-2003 10:41 AM
"Microsoft Mappoint" writing and Pushpin Highligth feanor MapPoint 2006/2009 Discussion 0 03-12-2003 05:47 AM


All times are GMT -5. The time now is 07:01 PM.


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


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