Hello,

This little Perl script has been puzzling me form some weeks.
MapInfo GIS Map windows can be reparented in a Visual Basic App
to create a customised mapping application using OLE Automation.

eg Visual Basic
        dim mapinfo as object
        Set mapinfo = CreateObject ("MapInfo.Application")
        mapinfo.do "set Application Window " & MapViewForm.hWnd  'Reparent 
dialogs
& error messaages
        mapinfo.do "set next document parent " & MapViewForm.hWnd & " Style 1"
'Reparent next doc window
        mapinfo.do "open table ""C:\Temp\map.tab"""
        mapinfo.do "map from mappoly"

I applied this to Perl using the Win32::OLE
        use Win32::OLE;
        use Win32::OLE::Const 'MapInfo';
        use Tk;

        my $mw = MainWindow->new
        my $mcanvas = $mw->Canvas( -width=>800, -height=>600);
        $mcanvas->pack;
        my $id = $mcanvas->id;

        $map = Win32::OLE->new("MapInfo.Application")
        $map->Visible                                                   # For 
debug only
        $map->do("Set Application Window &H$id");
        $map->do("Set Next Document Parent &H$id Style 1");     # Style 1 is 
child
window
        $map->do("open table \"C:\\Temp\\mappoly.tab\""
        $map->do("map from mappoly.tab");

This program works well opening mapinfo, opening the table etc until I apply
the map
statement to the program. This hangs the Tk canvas & MapInfo.
However,if I do the last line from the MapInfo App it works fine. Thus
following this line
I created a mapbasic executable that run the final 2 lines and called this
from Perl. This
results in MapInfo starting, but the Tk app never gets of the ground.

Any suggestion would be greatly appreciated.

Geoff Pearce



_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to