Community of VE/MapPoint Users and Developers
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 ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Writing files in a VB Addin? 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 |
| |||
| 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 ?
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| ||||
| 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 |
| ||||
| 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 |
| |||
|
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 |
| |||
| 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
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| ||||
| 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 |
| ||||
| 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 |
![]() |
| Tags |
| addin, files, writing |
| ||||
| 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 | |
| |
| ||||
| 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 |