我想在delphi中调用mapinfo 
我使用了以下于句 
MapInfo:=CreateOleObject('Mapinfo.application'); 
  str(Panel1.handle,hd); 
  MapInfo.do('Set Application Window'+hd); 
  MapInfo.do('set next document parent'+hd+'stylel'); 
  MapInfo.do('opentable"E:\地理信息系统\地理信息系统\备份\图\房屋.TAB"'); 
  MapInfo.do('Map From china'); 
  
但是, 
当运行到第三句的时候 
报错, 
found window[197878] while searching for [window] 
请问这是什么原因,如何解决?

解决方案 »

  1.   

    MapInfo:=createoleobject('MapInfo.application');
    str(Panel1.handle,hd);
    MapInfo.do('Set Application Window '+hd);
    MapInfo.do('Set Next Document Parent '+hd+'Style 1');
    MapInfo.runmenucommand(102);
    miTablename:=MapInfo.Eval('TableInfo(0,1)');
    MapInfo.do('map from '+miTablename);我打开一个地图以后,当进行这条语句的时候,
    MapInfo.runmunucommand(1702);
    出现错误
    runmunecommand not supported by automation object;
    我看许多资料都是这样写的,有什么问题吗?请赐教
      

  2.   

    你也是搞GIS的,我也是搞GIS的,咱们交流交流吧!QQ:106864312
      

  3.   

    str(panel2.handle,mapwindow);
       mapinfo.do('Set Next Document Parent '+mapwindow+' Style 1');
       mapinfo.do('Set Application Window '+mapwindow);   mapinfo.do('Open Table "'+tabpath+'china.tab" AS china');
       mapinfo.do('Open Table "'+tabpath+'province.tab" AS province');
       mapinfo.do('Open Table "'+tabpath+'pref_zhe.tab" AS pref_zhe');
       mapinfo.do('Open Table "'+tabpath+'cnty_zhe.tab" AS cnty_zhe');
       mapinfo.do('Open Table "'+tabpath+'cap4_zhe.tab" AS cap4_zhe');
       mapinfo.do('Open Table "'+tabpath+'cap2_zhe.tab" AS cap2_zhe');
       mapinfo.do('Open Table "'+tabpath+'capitals.tab" AS capitals');
       mapinfo.do('Map From china');
       mapinfo.do('Add Map Auto Layer cap4_zhe');
       mapinfo.do('Add Map Auto Layer cap2_zhe');
       mapinfo.do('Add Map Auto Layer capitals');
       mapinfo.do('Add Map Auto Layer province');
       mapinfo.do('Add Map Auto Layer pref_zhe');
       mapinfo.do('Add Map Auto Layer cnty_zhe');
       mapinfo.do('Set Map Zoom 6000 Units "Mi"');  // Entrie
      

  4.   

    哦,原来是拼写错误
    runmenucommand
    runmunucommand