最简单的delphi加载C++dll实例
来源:互联网 发布:windows 关键问题 编辑:程序博客网 时间:2024/06/05 21:05
C++的dll:
#ifndef _DLL_FOR_DEL_H_
#define _DLL_FOR_DEL_H_
extern "C"
{
_declspec(dllexport)int mult();
};
#endif
---------
#include "dllfordel.h"
int mult()
{
return 5*6;
}
================================delphi==========================
unit CPlusDllTest;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
CplusFuc=function():Integer;stdcall;
TForm1 = class(TForm)
lbl1: TLabel;
edt1: TEdit;
btn1: TButton;
btn2: TButton;
procedure btn1Click(Sender: TObject);
procedure btn2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
Func:CplusFuc;
hMhd:Thandle ;
ret:Integer;
implementation
{$R *.dfm}
procedure TForm1.btn1Click(Sender: TObject);
begin
hMhd:=LoadLibrary('dllfordel.dll');
if hMhd=null then
begin
Application.MessageBox('加载C++ dll失败',0)
end
else
begin
// Application.MessageBox('加载C++ dllsucess','加载dll',MB_OK) ;
@Func:=GetProcAddress(hMhd,'mult');
ret:=Func();
edt1.Text:=IntToStr(ret);
end;
end;
//end;
//end;
procedure TForm1.btn2Click(Sender: TObject);
begin
edt1.Text:='';
end;
end.
- 最简单的delphi加载C++dll实例
- 最简单的TTcpServer与TTcpClient通信实例-Delphi
- 有史以来最简单的三层实例(C#)
- 有史以来最简单的三层实例(C#)
- 有史以来最简单的三层实例(C#)
- 最简单的三层实例(C#)
- 有史以来最简单的三层实例(C#)
- 简单的dll加载
- 最简单DLL导出加载示例
- delphi调用c的dll
- VC++创建DLL工程最简单实例
- Silverlight使用WebService调用C++,Delphi编写的DLL文件【实例源码下载】
- Delphi 调用C/C++的DLL
- Delphi 调用C/C++的Dll
- Delphi调用C写的dll
- Delphi调用C#dll的问题
- Delphi&DLL简单应用
- delphi dll 实例 与 dll窗体实例
- 水样清纯的花样年华221
- 什么是长尾关键词193
- iar for arm 下载地址
- 最流行的JavaScript库jQuery不再支持旧版IE
- 如何高效编程?
- 最简单的delphi加载C++dll实例
- 在学习HTML5时,别忘了CSS技术
- 如何写出无法维护的代码?
- 【hive】How to use Elephant Bird with Hive
- 代码规范小结
- linux下lrzsz安装过程,SecureCRT上传下载文件工具
- [MySQL] 主流存储引擎介绍
- httpfox 下载地址
- 在DataGridView控件上实现列标头象Excel带数据筛选功能