Hello, All,
I can't get info anywhere on how to drive MapBasic applets from VFP.
I'm a total newbie to GIS but very experienced in VFP
I have MapInfo maps and I need to plot VFP-held routes along roads on
the maps
So I need to either invoke loads of MapBasic commands, through
integrated mapping, from VFP (and there's NO documentation on how to do
that - the nearest thing being VB examples), or construct small MapBasic
applets and invoke them from VFP. (and there's NO documentation on how
to do that)
I'm leaning toward the latter but my attempts have failed to do anything
other than bring up a useless VFP window, whatever MapInfo stuff going
on flashes up and then disappears as soon as the MapBasic .MBX is
finished. i.e. I see my map then it's gone. Below is my VFP code (and I
only got this far from the ONE example I could find at MapInfo's
website):
_________________________________
lcHWND = TRANSFORM( thisForm.hWnd )
loMapInfo = CreateObject("MapInfo.application")
lcHWND = transform( thisForm.hWnd )
loMapInfo.do( "Set Application Window " + lcHWND )
loMapInfo.do( "Set Next Document Parent " + lcHWND + " Style 1" )
lcProg = 'Run Application "C:\mcl_windows\Testbed\MapBas\junk2.MBX"'
loMapInfo.Do ( LcProg)
_________________________________
The MapBasic JUNK2.MB (just a familiarisation exercise) looks like:
_________________________________
Dim I as Integer
Include "MAPBASIC.DEF"
Open Table "C:\mcl_windows\Testbed\MapInfoMaps\UK_NUTS2.TAB" Interactive
Map From UK_NUTS2
Position (3,2) units "in"
Height 6 Units "in"
Width 8 Units "in"
Open Table "C:\mcl_windows\Testbed\MapInfoMaps\UK_REGNS.TAB" Interactive
Add Map Auto Layer UK_REGNS
set map redraw on
Open Table "C:\mcl_windows\Testbed\MapInfoMaps\UK_A_RDS.TAB" Interactive
Add Map Auto Layer UK_A_RDS
Open Table "C:\mcl_windows\Testbed\MapInfoMaps\UKCTY203.TAB" Interactive
Add Map Auto Layer UKCTY203
Open Table "C:\mcl_windows\Testbed\MapInfoMaps\UKMTRWAY.TAB" Interactive
Add Map Auto Layer UKMTRWAY
Open Table "C:\mcl_windows\Testbed\MapInfoMaps\suffolk\Streets.TAB"
Interactive
Add Map Auto Layer Streets
Set Map Layer 0 Editable On Selectable On
set map redraw on
Run Menu Command 1702
Create Pline 2 (0.969233,52.277931) (1.281258,52.121166) pen makepen( 2,
93, blue)
_________________________________
This all works but, as I said, quickly disappears. All I need is some
guidance to get off the ground and I'm OK. If you could possibly help
then please get in touch. If not, then at least thanks for reading
this.
TIA
Terry McDonnell (England)