I everyone,
I am new to the list but I need some help !
I have MapInfo running whith a Map window open and showing data using a projection XXX.
The projection should not matter, because the solution should work with any
projection.
I then run a Visual Basic program that get's the MapInfo Object and the coordinate
where
a user clicked on the map. The coordinates I need have to be in Longitude/Latitude so
the
mapbasic program uses the "set coordsys Earth projection 1, 0" command to transform
the coordinates
on the fly to the right coordinate system.
THE PROBLEM IS:
I run the program a first time and it works. I get the coordinates exactly as I need
them.
I then change the Map Window projection and try the program again and the coordinates
I get are not in Longitude/Latitude but in the new Map projection I just changed.
Wait, it get's worst...
If i run the program again (second, tird, fourth,...) time whithout changing the Map
Window projection,
then the coordinates are Ok.
Why does'nt it work the first time around after changing the Map window projection ?
My Visual Basic program uses the MapInfo Object and uses the Do and the Eval functions
to execute MapBasic Statements.
The next lines is the part of the code used to get the coordinates:
' MyVBProg
Set MIApp = GetObject(, "MapInfo.Application")
Cmd = "Set CoordSys Earth projection 1, 0"
MIApp.Do Cmd
' Get the click position with enough precision
Cmd = "Format$(CommandInfo(" & CMD_INFO_X & "),""###.########"")"
X = CDbl(MIApp.Eval(Cmd))
Cmd = "Format$(CommandInfo(" & CMD_INFO_Y & "),""###.########"")"
Y = CDbl(MIApp.Eval(Cmd))
' EndMyVbProg
Maxime Roy Ing. f.,
GI Geomat International Inc.
EMail: [EMAIL PROTECTED]
----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]