在TScrollBox中显示DLL的形式 [英] Show form from DLL in TScrollBox

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

问题描述

我在线发布:中显示表单从C $ c> TScrollBox

I posted this online: Show form from DLL in TScrollBox

我想要做的是调用并在Delphi中显示一个表单 TScrollBox
不作为显示 ShowModal

What i am trying to do is call and show a form in a Delphi TScrollBox. Not as Show or ShowModal

示例但不是与任何DLL:

Example but not with any DLL:

Form1.Parent:= ScrollBox;
 Form1.Show;

如何使用这个例子从一个DLL中的表单

How do i use this example from a DLL with a form inside

任何人都可以提供一个例子?

Can anyone provide an example?

问候,

推荐答案

问题解决了,这里是代码:

problem solved and here is the code:

//This is the DLL

library Project1dll;

uses    
  SysUtils,    
  Windows,    
  Classes,    
  DllForm in 'DllForm.pas' {frmDllForm}; // this is the other form

procedure Create_Form(ph: HWND);    
begin    
  frmDllForm:= TfrmDllForm.CreateParented(Ph);    
  frmDllForm.Show;    
end;

Exports    
Create_Form;

begin    
end.

//---------------------END--------------------------------------

//This is the project

unit Unit1;

interface

uses    
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;

type    
  TForm1 = class(TForm)    
    Button1: TButton;    
    ScrollBox: TScrollBox;    
    procedure Button1Click(Sender: TObject);    
  private    
  end;

procedure Create_Form(ph: HWND) ; external 'Project1dll.dll' name 'Create_Form';

var    
  Form1: TForm1;

implementation

{$R *.DFM}

function ScrollBoxDll(ph: HWND): Pointer; stdcall;    
begin    
  Create_Form(ph);    
end;

procedure TForm1.Button1Click(Sender: TObject);    
begin    
  ScrollBoxDll(ScrollBox.Handle);    
end;

end.

这篇关于在TScrollBox中显示DLL的形式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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