delphi+mapinfo使用ole连接遇到的错误(50分)

X

xln18

Unregistered / Unconfirmed
GUEST, unregistred user!
错误1:
var
xx:string;
begin

automap.do('select * from cosmetic1');
automap.do('Fecth first from selection');
automap.do('areax =area (selection.obj,"sq km")');
xx:=floattostr(automap.aval('areax'));
showmessage(xx);
end;

程序运行到fetch语句是出现‘未定义的控制 fetch’
可是该语句在mapbasic中调试正常,以前我在程序中
也用过fetch和alter命令都没有出错。
不知道现在为什么会出现这个错误?
错误2:
为了能够在程序中实时读出经纬度,在程序中建立了
一个类,在窗体创建过程中是这样调用的。
automap:=CreateOLEObject('mapinfo.application');
automap.do('Set Application Window ' + inttoStr(gps2000.Handle));
automap.do('Set Window Ruler Parent ' + inttoStr(gps2000.olemap.Handle));
auto:=comyfree.create;//调用程序中的类
automap.setcallback(auto);
功能实现都没有问题,可是关闭程序时弹出
There still active COM objects in this application.One or more clients
may have references to these objects,so mannually closing this application
may cause those client application(s) to fail.
Are you sure you want to close this application?
我在窗体close事件中automap:=null;auto:=null;
还是照样弹出错误。
希望大家能够帮帮忙分析一下,谢谢!
 
http://www.mapinfo.com.cn
字友上传区有一个VB的例子。也许对你有帮助。多联系[:D]
 
to yansh:
我会去看看那个vb的例子的。你的个人介绍中说你做gis方面的开发。
你是不是跟我一样的调用方法?
 
我的GIS用户要求很简单, 所 以 决 定 用VB+OLE 方 式, 那 个 例 子 可 能 就 差 不 多 了
犯 不 着 再 去 从 头 开 发, 用 最 少 的 时 间, 最 简 单 的 方 法, 满 足 客 户 需 求
, 何 乐 而 不 为:)。
 
我觉得第二个错误是COM(组件式对象模型)的连接没有断开的问题。
各位大富翁有没有这方面的经验。
 
我正好想问这个,我帮你顶顶,肯定是服务器建立后,没有消除,就是不知道怎么消除
 
在窗体close事件中加入代码:Application.MessageBox
 
顶部