Delphi - 多个远程COM对象 [英] Delphi - multiple remote com objects

查看:231
本文介绍了Delphi - 多个远程COM对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的D5应用程序在一个服务器被一对用户远程使用,所以我需要使用下面的功能来创建一个COM对象启动另一个应用程序(LmPos)安装回用户PC上启动时:

My D5 application is on a server being used remotely by a couple of users, so I need use the following function to create a COM object to launch another application (LmPos) installed back on that users PC upon launch:

CreateRemoteComObject(const MachineName: WideString; const ClassID: TGUID): IUnknown;

,而不是像之前一样创建本地COM对象:

rather than creating a local COM object as before:

EposServer := CreateOLEObject('POS.Server');

但是,要连接的MachineName和ClassID将取决于哪些用户正在启动此应用程序。我看到两个问题这个...

However, the MachineName and ClassID to connect to will depend on which users is launching this application. I see two problems with this...

参数必须是常量,那么如何分配它们变量?或者这是不可能的,因为它们是常量。

The parameters must be constant, so how can I assign them variable? Or is this impossible as they're constants.

如果我需要用户输入,我如何将字符串转换为TGUID?它似乎只接受格式:='{xxxx-xxxx-xxxx etc}'

If I demand user input, how do I convert the String in to a TGUID? It only seems to accept the format := '{xxxx-xxxx-xxxx etc}'

任何帮助将非常感谢。

Any help would be greatly appreciated. I'm not even sure if this is possible at present, I'm attempting to configure DCOM but not succeeding.

推荐答案

AFAIK是什么意思?服务器上的DCOM远程应用程序将始终以您记录的当前用户运行。

AFAIK the DCOM remote application on server will always run with the current user logged, as you stated.

如果可以,删除DCOM。它是一个已过时的技术,Windows 7和2008 Server不喜欢它。你需要在PC上强制SMB 1协议,即使这样,我们也有很多问题。

Get rid of DCOM if you can. It is a deprecated technology, and Windows Seven and 2008 Server do not like it. You'll need to force SMB 1 protocol on PCs, and even with that, we had a lot of problems.

最近我遇到了类似的问题,一些Delphi 5的应用程序池。我将现有Delphi 5应用程序的DCOM调用转换为HTTP服务,使用 http.sys内核模式服务器 WinHTTP 为客户端,模仿最初的DCOM类(客户端只有一个单位改变)。由于HTTP是无状态的,为了将事件从服务器推送到客户端,我在客户端类中添加了一个基于定时器的查询,以从服务器检索任何挂起的事件(500毫秒的时间足够和高效)。这个解决方案像Delphi 5现有的代码一样的魅力,最终客户就像速度和稳定性的结果一样。

I faced a similar issue recently with some Delphi 5 pool of applications. I converted the DCOM calls of existing Delphi 5 applications into a HTTP service, using http.sys kernel-mode server running in a Windows service (launched at server startup, even before any user is logged on), and WinHTTP for the client, which mimics the initial DCOM class (so on the client only one unit changed). Since HTTP is stateless, in order to push events from the server to the clients, I added a timer-based query in the client class, to retrieve any pending event from the server (a 500 ms timing is enough and efficient). This solution worked like a charm with Delphi 5 existing code, and the final customers just like the result in terms of speed and stability.

这篇关于Delphi - 多个远程COM对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆