我自己已经解决了,根本不用res,加一句话就行 mian in mian.pas然后定义一个过程显示窗体就可以了,
library DLL;{ Important note about DLL memory management: ShareMem must be the first unit in your library's USES clause AND your project's (select Project-View Source) USES clause if your DLL exports any procedures or functions that pass strings as parameters or function results. This applies to all strings passed to and from your DLL--even those that are nested in records and classes. ShareMem is the interface unit to the BORLNDMM.DLL shared memory manager, which must be deployed along with your DLL. To avoid using BORLNDMM.DLL, pass string information using PChar or ShortString parameters. } uses SysUtils, Classes, Dialogs, Forms, main in 'main.PAS';procedure showmainform(mainForm:TForm);stdcall; begin mainForm:=Tmainform.Create(mainForm); mainform.show; end; exports CdcopyShow; begin end.然后你调用就可以了,
上面的错了 library DLL;{ Important note about DLL memory management: ShareMem must be the first unit in your library's USES clause AND your project's (select Project-View Source) USES clause if your DLL exports any procedures or functions that pass strings as parameters or function results. This applies to all strings passed to and from your DLL--even those that are nested in records and classes. ShareMem is the interface unit to the BORLNDMM.DLL shared memory manager, which must be deployed along with your DLL. To avoid using BORLNDMM.DLL, pass string information using PChar or ShortString parameters. } uses SysUtils, Classes, Dialogs, Forms, main in 'main.PAS';procedure showmainform(mainForm:TForm);stdcall; begin mainForm:=Tmainform.Create(mainForm); mainform.show; end; exports showmainform; ////// begin end.然后你调用就可以了
FindResource
LoadResource
LockResource
FreeResource
"能不能直接封装成dell,也就是说从新编译我的代码,(把我的代码改成dll形式的?)"1.open project----youname.dpr
2.reaname----program -->library
3. add export :
a..in library file:
code :
export
youprocedure1 index1,
youfunction1 index2,
...
end; b..in unit files:
code:
procedure youprocedure1(...); stdcall;
function youfunction1(...):youtype; stdcall;
... 3.save project
4.build project
选中是不是就可以了,你试一下!
FindResource
LoadResource
LockResource
FreeResource
mian in mian.pas然后定义一个过程显示窗体就可以了,
first unit in your library's USES clause AND your project's (select
Project-View Source) USES clause if your DLL exports any procedures or
functions that pass strings as parameters or function results. This
applies to all strings passed to and from your DLL--even those that
are nested in records and classes. ShareMem is the interface unit to
the BORLNDMM.DLL shared memory manager, which must be deployed along
with your DLL. To avoid using BORLNDMM.DLL, pass string information
using PChar or ShortString parameters. }
uses
SysUtils,
Classes,
Dialogs,
Forms,
main in 'main.PAS';procedure showmainform(mainForm:TForm);stdcall;
begin
mainForm:=Tmainform.Create(mainForm);
mainform.show;
end;
exports
CdcopyShow;
begin
end.然后你调用就可以了,
library DLL;{ Important note about DLL memory management: ShareMem must be the
first unit in your library's USES clause AND your project's (select
Project-View Source) USES clause if your DLL exports any procedures or
functions that pass strings as parameters or function results. This
applies to all strings passed to and from your DLL--even those that
are nested in records and classes. ShareMem is the interface unit to
the BORLNDMM.DLL shared memory manager, which must be deployed along
with your DLL. To avoid using BORLNDMM.DLL, pass string information
using PChar or ShortString parameters. }
uses
SysUtils,
Classes,
Dialogs,
Forms,
main in 'main.PAS';procedure showmainform(mainForm:TForm);stdcall;
begin
mainForm:=Tmainform.Create(mainForm);
mainform.show;
end;
exports
showmainform; //////
begin
end.然后你调用就可以了