如何将TForm传递给DLL作为参数? [英] How can I pass TForm to a DLL as parameter?

查看:198
本文介绍了如何将TForm传递给DLL作为参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用tform作为参数使用dll,简单的计划是如果该表单传递给dll包含组件名称的dll文件返回数组。

i want to make dll that using tform as parameter, the simple plan is if that form passed to dll the dll file return array that contain components name.

它可能通过tform作为参数?

it possible to passing tform as parameter?

推荐答案

您的进程中很可能会有两个VCL实例,一个用于主机exe和一个为DLL。这是一个例子太多了。您的主机exe中的TForm类是与您的DLL中的TForm类不同的类。

Most likely you will have two instances of the VCL in your process, one for the host exe and one for the DLL. And that is one instance too many. The TForm class from your host exe is a different class from the TForm class in your DLL.

基本规则是您不能跨模块边界共享VCL / RTL对象,除非所有模块都使用与VCL / RTL运行时相同的实例。实现这一目标的方法是使用软件包链接到VCL / RTL。

The basic rule is that you cannot share VCL/RTL objects across module boundaries unless all modules use the same instance of the VCL/RTL runtime. The way to make that happen is to link to the VCL/RTL using packages.

这篇关于如何将TForm传递给DLL作为参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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