起码要比这个好
http://www.pudn.com/downloads189/ebook/detail890377.html-----------------------------------------------------------------
最近在研究这个dll封装form和调用,基本例子通过了。但遇到一些难题,如用TF1book控件执行大量循环就会程序崩溃,midform的childform窗体边界控制,主窗体标题栏变灰的情况,需要阅读一些应用级例子代码。
------------------------------------------------------------------
好了,如果能把上面链接中的例子,上传到csdn,给我下载,也可以另给分。
http://www.pudn.com/downloads189/ebook/detail890377.html-----------------------------------------------------------------
最近在研究这个dll封装form和调用,基本例子通过了。但遇到一些难题,如用TF1book控件执行大量循环就会程序崩溃,midform的childform窗体边界控制,主窗体标题栏变灰的情况,需要阅读一些应用级例子代码。
------------------------------------------------------------------
好了,如果能把上面链接中的例子,上传到csdn,给我下载,也可以另给分。
解决方案 »
- 求救,,关于TSringGrid 的Access Violation 问题
- 谁能推荐delphi的好书?
- 求助二维数组定义
- 谁帮我把下面这段代码译成delphi,谢谢!
- indy的IdTcpServer/IdtcpClient发送文件的基础问题,急用!解答马上给分
- 哪儿有检查Delphi程序运行中出现的内存泄露的软件下载
- 初学者问题!
- 如何让memo能用来输入法语?(出现的问题很奇怪)特急,up有分
- 关于在delphi中注册的问题,很急!
- 当我在 ToolButton 上的 Button 发一个 Wm_LbuttonDown 消息时,我如何得到该Button 的名字
- delphi数据库浏览
- 如何监听IE的脚本运行?并可以返回我自己的任意结果!?
library Project1;
uses
SysUtils,
Classes,
Forms,
Windows,
Messages,
Unit1 in 'Unit1.pas' {Form1};{$R *.res}
var
DLLApp: TApplication;function ShowForm(var App: TApplication;ParentForm: TForm): Boolean;export; stdcall;
begin
{获取调用窗体的Application,显而易见的功能是 能使你的窗体融合到调用程序中。通过它还能进行很多操作}
Application:= App;//将DLL的Application转为App
Form1:= TForm1.Create(ParentForm);//创建子窗体,子窗体随着ParentForm存在、释放。
Form1.FormStyle:= fsMDIChild;//设置窗体模式
Form1.Show;
end;{重写Dll入口函数,否则程序会出错}
procedure DLLUnloadProc(Reason: Integer); register;
begin
{DLL取消调用时,发送DLL_PROCESS_DETACH消息,此时将DLL的Application返回为本身}
if Reason = DLL_PROCESS_DETACH then Application:=DLLApp;
end;exports
ShowForm;begin
{在DLL入口预先储存DLL的Application}
DLLApp:=Application;
{DllProc:DLL入口函数指针。Delphi定义为 DllProc: TDLLProc;}
{在此指向我们自己定义的函数}
DLLProc := @DLLUnloadProc;
end.调用主程序单元,只需要一个TButton 就可以。
unit Unitmain;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, Menus, ToolWin, RzPanel, cxControls, cxContainer,
cxTreeView, dxNavBar, dxDockPanel, dxDockControl, ExtCtrls, RzSplit;type
TForm1 = class(TForm)
mm1: TMainMenu;
N1: TMenuItem;
pnl1: TPanel;
fsMDIChild1: TMenuItem;
DLL1: TMenuItem;
procedure DLL1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;function ShowForm(var App: TApplication; ParentForm: TForm): Boolean;stdcall; external 'Project2.dll';//为了简单,使用静态调用方法implementation{$R *.dfm}
procedure TForm1.DLL1Click(Sender: TObject);
begin
ShowForm(Application, Self);//调用DLL函数调出窗体。传入当前主程序的Application对象和Form1本身
end;end.
http://topic.csdn.net/u/20110223/09/15e9eea8-3a58-4bc9-81a4-4405e6eb8f6c.html