Hi Kristof,

This function will tell you the Window ID of a window by the name. If the 
window does not exist, it will return zero (0)

'**********************************************************************************************''
Function WINGetWindowID(ByVal szWinName As String) As Integer

Dim     i, nWID As Integer

OnError GoTo ErrorOccured

        WINGetWindowID = 0
        
        If szWinName = "" Then
                Exit Function
        End If
        
        For i = 1 To NumWindows()
                nWID    = WindowID(i)
                If WindowInfo(nWID, WIN_INFO_NAME) = szWinName Then
        
                        WINGetWindowID = nWID
                        Exit Function
        
                End If
        Next

        Exit Function
'-------------------------
ErrorOccured:
        Note "Oh oh, something didn't work as expected: " & lf & Error$()

End Function

But also remember that the name of your map changes everytim you add a new 
layer unless you specify a title on the window

Peter Horsb�ll M�ller
GIS Developer
Geographical Information & IT
 
COWI A/S
Odensevej 95
DK-5260 Odense S.
Denmark
 
Tel     +45 6311 4900
Direct  +45 6311 4908
Mob     +45 5156 1045
Fax     +45 6311 4949
E-mail  [EMAIL PROTECTED]
http://www.cowi.dk/gis


-----Original Message-----
From: Kristof Vydt [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 04, 2005 2:48 PM
To: [email protected]
Subject: MI-L Check if map window is open


Any idea how to check if a map (identified by its name) is already open ?
 
In my MapBasic code I run the same "Map From" line several times. This results 
in several instances of the same window. I'd like to put it in an "if ... 
then", but I have no idea how to check if the map is already open.
 
The complex structure of the program does not allow me to use a variable that 
holds info on the status of this map ("already open" or "not yet open").
 
Kristof Vydt

Send instant messages to your online friends http://uk.messenger.yahoo.com 

Reply via email to