打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
COM & Late binding
Some other languages can do this. I thing it is possible in Delphi.
In Delphi Construction:

var v : variant;
begin
    v:=CreateOleObject('Server.Class');
    result:=v.Method(param1,param2);
end;

Compiler doesn't know any interafaces, everything is based on IDispatch. At
runtime delphi reads type library, bat I don't know how to do this on my
own.


Sat, 26 Nov 2005 20:05:06 GMT

Re:COM & Late binding

Oh, you're talking about IDispatch stuff (forgot about that one), not
general COM objects ... that makes it easier (read possible :) )

There's two ways of doing this: the
low-level-well-documented-but-insanely-complicated way, and the
no-documentation-but-can-be-made-to-work-in-less-code way (aka the Delphi
way).

For the low-level way, read up on MSDN about the Invoke method of IDispatch.
I advise a strong drink and a large amount of time available before you do
this. I gave up trying to understand the whole low-level thing of Dispatch
interfaces a while ago after seeing what actually goes on :)

For the Delphi way, dive head-first into the ComObj unit. The bit you're
after is the semi-undocumented VarDispInvoke in ComObj, which is what the
compiler actually emits when it compiles your code. This is actually
referenced through (the slightly more documented) VarDispProc. You still
need to do a bit of work to get this to go though, and you need to do stuff
like calling bits of the IDispatch interface to get the method IDs from the
names.

Either way, you're fighting an uphill battle, and should ask youself first
whether there is anther way of doing it.

--

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
Delphi WebBrowser始终在当前窗口打开新网页
【口语天天练】be in the way
M,G分别是什么单位的简写?是10的几次方?
学习使用Delphi 2009 开发 Word 2003 插件 <一>
奇技淫巧之Delphi和JavaScript互通 | 武稀松(wr960204)的博客
Jacob调用COM组件总结,实例
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服