I was attempting to use the code posted by Uffe at
www.routeware.dk/download/close_unused.zip to close any
unused tables when I close a Mapper window. Unfortunately, it seems like
closing any tables which were on
the window being closed produces a crash for Mapinfo 99% of the time. I am
using Windows 2K and Mapinfo 7.8
The errors can be reproduced by using the code below and closing a mapper
window.
Any help appreciated.
Thanks,
Jay Russell
Sub WinClosedHandler
Call CloseUnused
End Sub
Sub CloseUnused
OnError Goto CloseImageTableError
Dim window_num As SmallInt
Dim numTabs,i,j,Window_ID as integer
Dim TableNames(1) as string
Dim InUse(1) as logical
numTabs = NumTables()
Redim TableNames(numTabs)
Redim InUse(numTabs)
For i = 1 to numtabs
TableNames(i) = TableInfo(i,TAB_INFO_NAME)
InUse(i) = False
Next
for window_num = 1 to NumWindows()
Window_ID = WindowID(window_num)
do case WindowInfo(Window_ID,WIN_INFO_TYPE)
case WIN_MAPPER
for i = 1 to MapperInfo(Window_ID,MAPPER_INFO_LAYERS)
for j = 1 to numtabs
if TableNames(j) = LayerInfo(Window_ID,i,LAYER_INFO_NAME) then
InUse(j) = True
end if
next
next
case WIN_BROWSER
case WIN_LAYOUT
case WIN_GRAPH
end case
next
j = 0
For i = 1 to numtabs
close table TableNames(i)
print "Table "+TableNames(i)+" closed"
j = j+1
Next
print j+" tabels closed in total"
Exit Sub
CloseImageTableError:
Note "WinClosedHandlerError:" + Error$()
End Sub
---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 14568