Ash
You need to do more than you currently are to get rid of MapInfo.
Suggest you have an exit routine which is also called from your form unload
event so that even a crash will (should) clean up. Set a module level
boolean flag to say whether you've completed this run of code.
First - commit all the open tables to sort out your problem with TIN, TDA,
TMA files (unsaved edit transactions).
eg
dim iTabs as integer, iLoop as integer
on Error resume next
if Not(bHaveClearedUpAfterMyself) then
iTabs = oMap.eval ("NumTabs")
for iLoop = 1 to iTabs
omap.do "Commit table " & iLoop
next
'Then close the lot
omap.do "Close all"
'Then release the running instance of MapInfo - if you are using
callbacks you need to set the callback object to nothing first. You won't
get an error so include this line anyway.
omap.setcallback = Nothing
Set oMap = nothing 'This actually shuts down MapInfo by releasing
the reference. Make sure no other modules have a handle on oMap. so
you don't get circular references.
bHaveClearedUpAfterMyself = true
end if
What I've done is stick all this inside a class with the instantiation and
release of a MapInfo session on the initialise and terminate events. This
also allows me to build my own methods and properties for map interaction
and is why I'm always moaning about a proper COM model.
If you want to get a handle on a currently running Mapinfow.exe that you've
'lost' then use GetObject - but bear in mind that your oMap reference could
have lost MapInfo without becoming null. I have a custom version of do and
eval on my class, and use error handling around the do and eval statements
to cover this.
HTH
Paul Crisp
Syntegra
Innovation Place Delta Bank Road Newcastle NE11 9DJ
Tel 0191 461 4522 Fax 0191 460 1987
-----Original Message-----
From: Simmonds, Ashley (PTB) [mailto:[EMAIL PROTECTED]]
Sent: 10 September 2002 02:58
To: 'Mapinfo List (E-mail)'
Subject: MI-L integration stability
hey people,
does anyone have some stability routines for integrating mapinfo in
VB/Access?
basically mapinfo is being opened and closed fairly often, and sometimes
does not close properly, which will then cause the TIN/TDA temp files it was
using to not be released, (not to mention the 20 meg footprint) so that the
next time the user tries to use the program it comes up with errors saying
that it's being used by another user. the only way i can release it
presently is through dumping it in task manager.
is there perhaps a better way to close mapinfo, the way i do it is through
RUNMENUCOMMAND 113, which is MapInfo'ese for FILE,EXIT.
also when i'm doing development stuff, my variables and objects often lose
their reference, so that when i attempt to close stuff it give me the
'Object not set' error, and i want a global routine which traps this error
(error 91), then checks to see if MapInfo is indeed running, and if so, set
the object to be the currently running application. i keep coming up with
automation errors when i attempt this, and it sends the user to my code
window, which isn't necessarily where i want them.
gramercy
ash
********************************************************************
This email may contain information which is privileged or confidential. If you are not
the intended recipient of this email, please notify the sender immediately and delete
it without reading, copying, storing, forwarding or disclosing its contents to any
other person
Thank you
Check us out at http://www.syntegra.com
********************************************************************