我用vc++写了底层dll,为了省去界面的代码,我用delphi作的前台
我在delphi中自定义了一个类,并且在程序实例化了两个类变量
如:
c1,c2:TCapture;
在使用过程中,我分别调用了变量1和变量2的初始化:
如:
c1.Create();
c2.Create();
问题出现了,等我使用时发现我调用c1的成员函数使用的是c2的初始化的内容
是由于我在一个进程调用的共享dll了吗/还是delphi中的堆栈问题
不胜感激!!
我在delphi中自定义了一个类,并且在程序实例化了两个类变量
如:
c1,c2:TCapture;
在使用过程中,我分别调用了变量1和变量2的初始化:
如:
c1.Create();
c2.Create();
问题出现了,等我使用时发现我调用c1的成员函数使用的是c2的初始化的内容
是由于我在一个进程调用的共享dll了吗/还是delphi中的堆栈问题
不胜感激!!
解决方案 »
- 请教如何用copy 或者RightStr来判断多类型?
- 如何在Delphi实现对全盘文件读写监视
- 如何在DELPHI 6中判断是否安装了ORCALE 8的客房端?
- delphi巨难问题,谁要帮我解决我给谁,问了N久没人回的问题
- 急,请问怎样将一些控件放入一个TGroupbox中去,比如说一个button,其中button先放到一个Form里,当我把Groupbox放进去时,button被盖住了.
- 如何实现对于EDIT中输入内容的模糊查找?或者有比EDIT更方便的控件?
- 请问怎样在程序中禁用Windows的各个热键?
- 请问如何使一个数据库的数据记录数量可被某个整数整除呢?
- 请教如何实现当MOUSE点中窗体的某一部分并移动MOUSE时可以移动窗体,而不需要点中窗体的标题栏才可以移动窗体???
- 同行大家好,请帮帮忙:如何让语句来实现DBGrid的全部选中或反向选择呢?
- 请问哪个网站有DELPHI7.0下载!!!急!
- Data Controls控件中哪些控件需要自己加入数据?
implementation
procedure Convent(bmp:Tbitmap); stdcall; external 'prjBmpDll.dll';{$R *.DFM}procedure TForm1.Button1Click(Sender: TObject);
var
bmp:Tbitmap;
begin // if opd.Execute then
opd.FileName := '2.bmp';
begin
bmp :=tbitmap.create;
bmp.LoadFromFile(opd.FileName);
image1.Picture.Assign(bmp);
Convent(bmp);
image2.Picture.Bitmap.Assign(bmp);
end;end;
//
dll中
procedure Convent(bmp:Tbitmap); stdcall;
implementation
//把bmp转为2色。
procedure Convent(bmp:Tbitmap);
begin
if bmp.PixelFormat = pf1bit then
begin
bmp.PixelFormat := pf8bit;
// bmp.Mask(clred);
bmp.TransparentColor :=clred;
bmp.Transparent := true;
end
else
begin
bmp.PixelFormat := pf1bit;
bmp.Mask(clred);
end;
bmp.SaveToFile('2.bmp');
end;
c2:=TCapture.create;应该没有问题的。我一直就是vc、delphi混合编程的。
c2:=TCapture.create;不会是连基本的语法都忘了吧!
vc++中的win32 dll(MyTeset.dll):...
int x;
_declspec(dllexport) _stdcall void SetValue(int Param)
{ x=Param;
}
_declspec(dllexport) _stdcall int GetValue()
{ return x;
}
delphi中调用(TTest的类定义):
type
TTest=class(CObject)
procedure test_setvalue(Param:integer);
function test_getvalue():integer;
end;
implemention
procudure Setvalue(Param:integer);stdcall;external'MyTest.dll'
function Getvalue():integer;stdcall;external'MyTest.dll'TTest.test_setvalue(Param:integer)
begin
SetValue(Param); end;
TTest.test_getvalue(Param:integer):integer
begin
return GetValue(Param); end;
end.
delphi中的测试调用:
...
type
Tform=class
procedure test();
...
end;
c1,c2:TTest;
...
procedure Tform.test()
begin
c1:=TTest.Create();
c2:=TTest.Create();
c1.test_setvalue(10);
c2.test_setvalue(20);
showmessage(inttostr(c1.test_getvalue));
showmessage(inttostr(c2.test_getvalue));
end;结果:
20
20同进程是否会覆盖掉dll中的内容呢?