DLL_Delphi动态调用
2024-09-30 15:29:53
1、动态调用DLL
unit formMain; interface uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls; type
TfrmMain = class(TForm)
btnLoadLibrary: TButton;
procedure btnLoadLibraryClick(Sender: TObject);
private
{ Private declarations }
public
procedure LoadDllZ;
end; TfnC_ExecJS = function(_pSvgFrm :Pointer; _pcJS :PChar):integer;stdcall;
TfnD_PassStId = function(_Sender :Pointer; _pcStId :PChar):integer;stdcall; var
frmMain: TfrmMain;
// ***
g_fnExecJS : TfnC_ExecJS;
g_fnPassStId :TfnD_PassStId; implementation {$R *.dfm} { TfrmMain } procedure TfrmMain.LoadDllZ;
var hDll :Cardinal;
iRtn :integer;
begin
hDll := LoadLibrary(PChar('DrRemoteCall.dll'));
if hDll = then
begin
Exit;
end; @g_fnExecJS := GetProcAddress(hDll, 'ExecJS');
@g_fnPassStId := GetProcAddress(hDll, 'PassStId'); if not Assigned( g_fnExecJS ) then
begin
FreeLibrary(hDll);
Exit;
end;
if not Assigned( g_fnPassStId ) then
begin
FreeLibrary(hDll);
Exit;
end; // ZC: 调用函数
iRtn := g_fnExecJS(nil, 'TestCC'); FreeLibrary(hDll);
ShowMessage('out');
end; procedure TfrmMain.btnLoadLibraryClick(Sender: TObject);
begin
LoadDllZ;
end; end.
2、
3、
4、
5、
最新文章
- Docker部署Hadoop集群
- JS(javascript) 将网站加入收藏夹
- [翻译]Bob大叔:反思极限编程
- Servlet-中文乱码
- [数据结构与算法]哈夫曼(Huffman)树与哈夫曼编码
- Java多线程——<;一>;概述、定义任务
- 如何用css3实现风车效果
- ios 工程配置统一增加类的前缀(知识点也只能算知识点)
- NFC手机
- SWOT自我分析
- Hibernate创建SessionFactory实例
- EasyNetQ WithTopic过滤失效的解决方案
- Python之旅.第二章数据类型 3.19/3.20/3.21/3.22/3.23
- SAP Hybris电子商务最新功能
- Redis集群中的节点如何保证数据一致
- Mac下Eclipse读取不到环境变量
- Putty的用法
- JS截取字符串方法实例
- django学习--1
- HDU - 1525
热门文章
- python常见模块之random模块
- java7(2)——使用mutilcatch注意事项
- PAT 1033 To Fill or Not to Fill[dp]
- genymotion——在虚拟机中当中安装genymotion,启动已经新增好的设备时,提示:the virtual device got no ip address
- 记录:正确率、召回率、F值
- python3 爬虫神器pyquery的使用实例之爬网站图片
- Portal系统中当切换学生时仍旧停留在当前页面的实现方法
- 002-jdk10安装
- 『NiFi 节点本地流与集群流不一致导致集群加入失败』问题解决
- Python之路——线程池