H
huangjihua
Unregistered / Unconfirmed
GUEST, unregistred user!
----Dll 单元文件:——————
unit MainDll_Frame;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ImgList, ComCtrls, ExtCtrls, StdCtrls, Menus;
type
TMainDllFrame = class(TForm)
MainMenu: TMainMenu;
System1: TMenuItem;
Exit1: TMenuItem;
StatusBar1: TStatusBar;
Left_Telescopic: TSplitter;
MainInfo_Place: TScrollBox;
Additive_FunctionPlace: TPanel;
Down: TPanel;
Label3: TLabel;
Label4: TLabel;
Down_Curly: TImage;
Up: TPanel;
Label1: TLabel;
Label2: TLabel;
Up_Curly: TImage;
TreeNode_Info: TPanel;
Panel4: TPanel;
Show_PrivilegeNode: TTreeView;
Active_Infoplace: TPanel;
Top_ShowInfo: TPanel;
Curly_Img: TImageList;
private
{ Private declarations }
public
{ Public declarations }
SeaLun : TForm;
end;
var
MainDllFrame: TMainDllFrame;
implementation
{$R *.dfm}
end.
——————DLL工程文件————————————
library MainFrame_DLL;
uses
Windows, SysUtils, Classes,Forms,
MainDLL_Frame in 'MainDLL_Frame.pas' {MainDLLFrame};
{$R *.res}
Procedure LoadMainFrame(App : HWND; Form : TForm);stdcall;export;
begin
Application.Handle := App;
With TMainDLLFrame.Create(Application) DO
begin
Try
SeaLun := Form;
Showmodal; //or show;
Finally
Free;
end;
Application.Handle := 0;
end;
end;
begin
end.
——————Unit 单元调用Dll——————
unit Main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TMainForm = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
Procedure LoadMainFrame(App : HWND; Form : TForm);stdcall;external 'MainFrame_DLL.dll';
var
MainForm: TMainForm;
implementation
{$R *.dfm}
procedure TMainForm.Button1Click(Sender: TObject);
begin
LoadMainFrame(Application.Handle, Self);
end;
end.
小弟在上面写了一个测试用的DLL,我想Dll应该是写对的!运行正确!不过它怎么要指定一个.exe啊??这里有什么用的(问题一?)。 问题二:Dll运行正确,但是我在另外的一个单元文件里调用它,怎么老是提示:初始化应用程序正常(0xc0000007b)失败,不是这里出了什么问题?? 问题三:已编译好的Dll应该是可以独立的吧?就是说,其他的Delphi或c/c++调用的时候只要一个Dll文件就行了,而其他的.dcu,.pas或其他的文件应该是不要的吧?? 问题四:比如:当我写一个含有Panel,label,edit的Dll的时候可以在uses中不写如unitX in 'Unitx.pas' {Formx};吗?就是我自己自定义一个过程或函数:在过程或函数中
var
Label : TLabel;
begin
//这里创建,并知道parent是那个!
end;
不知道我这样写一个创建控件的Dll行不行得通??
问题好像有点多了,但还是请高手解答,期待~~~~~~~~~~~~~~~~~~~~~~~~~~~~
unit MainDll_Frame;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ImgList, ComCtrls, ExtCtrls, StdCtrls, Menus;
type
TMainDllFrame = class(TForm)
MainMenu: TMainMenu;
System1: TMenuItem;
Exit1: TMenuItem;
StatusBar1: TStatusBar;
Left_Telescopic: TSplitter;
MainInfo_Place: TScrollBox;
Additive_FunctionPlace: TPanel;
Down: TPanel;
Label3: TLabel;
Label4: TLabel;
Down_Curly: TImage;
Up: TPanel;
Label1: TLabel;
Label2: TLabel;
Up_Curly: TImage;
TreeNode_Info: TPanel;
Panel4: TPanel;
Show_PrivilegeNode: TTreeView;
Active_Infoplace: TPanel;
Top_ShowInfo: TPanel;
Curly_Img: TImageList;
private
{ Private declarations }
public
{ Public declarations }
SeaLun : TForm;
end;
var
MainDllFrame: TMainDllFrame;
implementation
{$R *.dfm}
end.
——————DLL工程文件————————————
library MainFrame_DLL;
uses
Windows, SysUtils, Classes,Forms,
MainDLL_Frame in 'MainDLL_Frame.pas' {MainDLLFrame};
{$R *.res}
Procedure LoadMainFrame(App : HWND; Form : TForm);stdcall;export;
begin
Application.Handle := App;
With TMainDLLFrame.Create(Application) DO
begin
Try
SeaLun := Form;
Showmodal; //or show;
Finally
Free;
end;
Application.Handle := 0;
end;
end;
begin
end.
——————Unit 单元调用Dll——————
unit Main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TMainForm = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
Procedure LoadMainFrame(App : HWND; Form : TForm);stdcall;external 'MainFrame_DLL.dll';
var
MainForm: TMainForm;
implementation
{$R *.dfm}
procedure TMainForm.Button1Click(Sender: TObject);
begin
LoadMainFrame(Application.Handle, Self);
end;
end.
小弟在上面写了一个测试用的DLL,我想Dll应该是写对的!运行正确!不过它怎么要指定一个.exe啊??这里有什么用的(问题一?)。 问题二:Dll运行正确,但是我在另外的一个单元文件里调用它,怎么老是提示:初始化应用程序正常(0xc0000007b)失败,不是这里出了什么问题?? 问题三:已编译好的Dll应该是可以独立的吧?就是说,其他的Delphi或c/c++调用的时候只要一个Dll文件就行了,而其他的.dcu,.pas或其他的文件应该是不要的吧?? 问题四:比如:当我写一个含有Panel,label,edit的Dll的时候可以在uses中不写如unitX in 'Unitx.pas' {Formx};吗?就是我自己自定义一个过程或函数:在过程或函数中
var
Label : TLabel;
begin
//这里创建,并知道parent是那个!
end;
不知道我这样写一个创建控件的Dll行不行得通??
问题好像有点多了,但还是请高手解答,期待~~~~~~~~~~~~~~~~~~~~~~~~~~~~