不用VCL,那样dll好几百K.
解决方案 »
- delphi不使用控件,如何直接带参数调用存储过程,并读出结果集?
- 急!!高分求一自动根据排名给分的算法~望高人指点
- Dephi能写B/S结构的程序吗?有没有用ASP或ASP.NET写方便啊?
- 小问题很急!!!!!!!!!
- 100分--求机房管理系统
- 怎么总是显示"由于目标机器积极拒绝,无法连接"
- 如何获得已经安装的主要软件?
- 请问几个东东是什么意思 我现在正在用
- 请问诸位大虾:“从中间层的方法中返回一个结果集,用哪种方法比较好?”
- 表单提交到dll文件后,从数据库取出符合条件的记录,返回的时候,为什么...
- ListView、TreeView 图标 叠加的问题有点难!
- 如何读取LWP格式的文件
library Project1;uses
Forms,
Unit1 in 'Unit1.pas' {Form1};procedure test;
begin
Application.CreateForm(TForm1, Form1);
form1.show;
end;
{$R *.res}
exports test;
begin
end.在unit单元的内容:
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}end.这样编译后就是一个dll了。
program Project1;uses
Forms,
Unit2 in 'Unit2.pas' {Form1};{$R *.res}begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.在unit单元的内容:
unit Unit2;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;procedure test; far;external 'project2.dll';implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
begin
test;
end;end.
如果这个看不懂,我就没办法了
你这个DLL怕有200K吧?再加点控件就过300了我只是想知道怎么用SDK加上窗口,在窗口放一些控件,DLL和普通Exe不一样,有些工作要做,我想有经验的给点Tip, 我可以少走弯路.
我不想他太大而已,做成DLL就是为了小.
带包编译啊
这样还是大(加上包),不过DLL多了就不觉得了,但其他语言能调用吗?
DLL:
unit U_APIform;interfaceuses
Windows, Messages, SysUtils;function ShowAPIModlessForm(AHandle: THandle): Longint; stdcall;implementationconst
AppName = 'DllAPIform';function DummyWindowProc (Wnd: hWnd; Msg, wParam: Word;
lParam: LongInt): LongInt; stdcall;
begin
Result := 0;
case Msg of
WM_DESTROY: PostQuitMessage(0);
else
Result := DefWindowProc(Wnd, Msg, wParam, lParam);
end;
end;function ShowAPIModlessForm(AHandle: THandle): Longint;
var
cls: TWndClass;
Wnd: hWnd;
begin
Result := 0;
FillChar(cls, SizeOf(cls), 0);
cls.lpfnWndProc := @DummyWindowProc;
cls.hInstance := AHandle;
cls.lpszClassName := AppName;
RegisterClass(cls); Wnd := CreateWindowEx(0, AppName, AppName,
WS_VISIBLE or //µ÷ÊÔʱÓÃ;
WS_SIZEBOX or WS_CAPTION or WS_POPUP,
363, 278, 305, 200, 0, 0, AHandle, nil);
if Wnd > 0 then
begin
UpdateWindow(Wnd);
ShowWindow(Wnd, SW_SHOW);
Result := Wnd;
end;
end;end.library DllAPIform;uses
U_APIform in 'U_APIform.pas';{$R *.res}exports
ShowAPIModlessForm;begin
end.调用:
function ShowAPIModlessForm(AHandle: THandle): Longint;
stdcall; external 'DllAPIform.dll';procedure TForm1.btnShowAPIModlessFormClick(Sender: TObject);
begin
if FAPIForm = 0 then
FAPIForm := ShowAPIModlessForm(Application.Handle);
end;这样就可以把DLL中的无模式子窗体显示出来了:)