Delphi - DLL中的表单 - 提示不显示 [英] Delphi - Form in DLL - Hints not showing

查看:120
本文介绍了Delphi - DLL中的表单 - 提示不显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个DLL中的Delphi窗体(我知道这限制了使用DLL到Delphi,但这不是一个问题在这种情况下)。



该DLL导出一个函数 ShowForm ,看起来大致如下:

  ShowForm(App:TApplication); 
begin
OldApp:=应用程序;
try
应用程序:= App;
MyForm:= TMyForm.Create(nil);
try
MyForm.ShowModal;
finally
FreeAndNil(MyForm);
结束
finally
应用程序:= OldApp;
结束
结束

现在在表单上我使用了一个 TAdvOfficeHint (来自TMS组件包)。不幸的是,这些提示没有出现。



我在这里遗漏了什么?如何从主应用程序中显示该表单的行为方式呢?



谢谢!

解决方案

我不知道 TAdvOfficeHint 但我猜它钩子 Application.OnShowHint 设置自己的 THintWindowClass ,即使主要可执行文件和DLL都在TMS单元中链接,它们都有自己的类的副本,事情出错了。



分配应用程序还不够:还有其他全局变量,如屏幕鼠标等。其他人甚至隐藏在实现中,所以我会说你的机会使表单行为正确从主应用程序是苗条的。


I have a Delphi form inside a DLL (I know that this restricts the use of the DLL to Delphi but this is not a problem in this case).

The DLL exports a function ShowForm that looks roughly like this:

procedure ShowForm (App : TApplication);
begin
  OldApp := Application;
  try
    Application := App;
    MyForm := TMyForm.Create (nil);
    try
      MyForm.ShowModal;
    finally
      FreeAndNil (MyForm);
    end;
  finally
    Application := OldApp;
  end;
end;

Now on the form I use a TAdvOfficeHint (from the TMS component pack). Unfortunately the hints do not show up.

Am I missing something here? How can I make the form behave exactly as it would if I showed it from the main application?

Thanks!

解决方案

I don't know TAdvOfficeHint but I guess it hooks Application.OnShowHint to set its own THintWindowClass, and even if both the main executable and the DLL are linking in the TMS unit, they each have their own copy of the class which is where things go wrong.

Assigning Application is not enough: there are other global variables, like Screen, Mouse, etc. Others are even hidden in the implementation so I'd say your chances to make the form behave exactly as from the main application are slim.

这篇关于Delphi - DLL中的表单 - 提示不显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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