W
wlcwe
Unregistered / Unconfirmed
GUEST, unregistred user!
我刚学dll调用,编了个很简单的程序如下
********************
Project1.dll
*******************
library Project1
uses
SysUtils,
Classes
{$R *.res}
function a(bchar)char
stdcall
begin
result:=b
end
exports
a index 1 name 'mya' resident
begin
end.
***************
调用dll的exe文件
+++++++++++++++++
.......前面省略
{$R *.dfm}
type
Tc=function(dchar)char
procedure TForm1.Button1Click(Sender: TObject)
var
fchar
echar
P:Tc
M:Thandle
begin
m:=loadlibrary('Project1.dll')
if m<>0 then
p:=Tc(getprocaddress(m,'mya'))
e:=stralloc(80)
e:=strpcopy(e,edit1.Text)
f:=p(e)
edit2.Text:=f
freelibrary(M)
end
end.
编译后在Edit1里输如字符串但在edit2中出来的却是乱码,不管怎么输出来的都是'祧h'这个乱吗,快帮帮我啊,急急急急急急急急急急急急急急!!!!
我用的是delphi6,
********************
Project1.dll
*******************
library Project1
uses
SysUtils,
Classes
{$R *.res}
function a(bchar)char
stdcall
begin
result:=b
end
exports
a index 1 name 'mya' resident
begin
end.
***************
调用dll的exe文件
+++++++++++++++++
.......前面省略
{$R *.dfm}
type
Tc=function(dchar)char
procedure TForm1.Button1Click(Sender: TObject)
var
fchar
echar
P:Tc
M:Thandle
begin
m:=loadlibrary('Project1.dll')
if m<>0 then
p:=Tc(getprocaddress(m,'mya'))
e:=stralloc(80)
e:=strpcopy(e,edit1.Text)
f:=p(e)
edit2.Text:=f
freelibrary(M)
end
end.
编译后在Edit1里输如字符串但在edit2中出来的却是乱码,不管怎么输出来的都是'祧h'这个乱吗,快帮帮我啊,急急急急急急急急急急急急急急!!!!
我用的是delphi6,