Delphi

delphi 函数指针

半城伤御伤魂 提交于 2020-02-19 17:36:52
Pascal 中的过程类型与C语言中的函数指针相似 ,为了统一说法,以下称函数指针。函数指针的声明只需要参数列表;如果是函数,再加个返回值。下面讲解指向非对象(一般的)函数/过程的函数指针。 例如声明一个过程类型,该类型带一个通过引用传递的整型参数: type IntProc = procedure (var Num: Integer); // IntProc是指向过程的函数指针 这个过程类型与任何参数完全相同的例程兼容,即用它声明的变量,可以指向任何此类函数,并通过其进行函数的调用。 下面是一个兼容例程: procedure DoubleTheValue (var Value: Integer); begin Value := Value * 2; end; 函数指针能用于两种不同的目的:声明函数指针类型的变量;或者把函数指针作为参数传递给另一例程。利用上面给定的类型和过程声明,你可以写出下面的代码: var IP: IntProc; X: Integer; begin IP := DoubleTheValue; X := 5; IP (X); end; 虽然这种调用方法比直接调用麻烦了,那么我们为什么要用这种方式呢? (1)因为在某些情况下,调用什么样的函数需要在实际中(运行时)决定,你可以根据条件来判断,实现用同一个表达,调用不同的函数,很是灵活. (2

Delphi动态调用C++写的DLL

情到浓时终转凉″ 提交于 2020-02-19 17:36:37
c++ DLL 文件,建议用最简单的c++编辑工具。不会加入很多无关的DLL文件。本人用codeblocks+mingw。不像 VS2010,DLL编译成功,调用的时候会提示缺其他DLL。 系统生成的main.h和main.cpp #ifndef __MAIN_H__ #define __MAIN_H__ #include <windows.h> /* To use this exported function of dll, include this header * in your project. */ #ifdef BUILD_DLL #define DLL_EXPORT __declspec(dllexport) #else #define DLL_EXPORT __declspec(dllimport) #endif #ifdef __cplusplus extern "C" { #endif int DLL_EXPORT Add(int plus1, int plus2); //导出函数Add #ifdef __cplusplus } #endif #endif // __MAIN_H__ #include "main.h" // a sample exported function int DLL_EXPORT Add(int plus1, int plus2) /

Delphi XE FireDac 连接池

☆樱花仙子☆ 提交于 2020-02-19 17:08:01
在开发Datasnap三层中,使用FireDac 连接 MSSQL数据库。 实现过程如下: 1、在ServerMethods 单元中放入 FDManager 、FDPhysMSSQLDriverLink1、FDGUIxWaitCursor1等控件。 2、自定义过程: private var oParams: TStrings; procedure TSrvMethods.SetupFDManager; //加载数据库链接信息。 begin //*****初始化***** oParams := TStringList.Create; //********* 连接池 oParams.Add('DriverID=MSSQL'); //oParams.Add('CharacterSet=utf8'); oParams.Add('Server=192.168.1.199'); //oParams.Add('Port=3306'); oParams.Add('Database=DSCSYS'); oParams.Add('User_Name=sa'); oParams.Add('Password='); // 毫秒 oParams.Add('POOL_CleanupTimeout=36000'); // 毫秒 oParams.Add('POOL_ExpireTimeout=600000');

DELPHI开发和使用REDIS

三世轮回 提交于 2020-02-19 13:48:36
DELPHI开发和使用REDIS REDIS SERVER是独立的存在,支持WINDOWS,LINUX REDIS PUB/SUB 用于聊天 只是其中的一种用法 任何消息或其他类型数据 都可以 必须安装 REDIS SERVER 可同时订阅多个发布的频道 也可以用于 中间件集群之间 异步消息队列 任务调度 还可以用于 数据集。。。等类型数据的缓存 查询 咏南中间件做好了 REDIS样板插件和客户端调用DEMO,基于 MORMOT和CROSS SOCKET(LINUX) 的HTTP通讯 https://www.cnblogs.com/hnxxcxg/category/1410002.html 一些我整理的REDIS资料 其他用法?您可以充分地自由想像。或者欢迎一起交流沟通 来源: https://www.cnblogs.com/hnxxcxg/p/12330736.html

How I can check if a Window has visible scrollbars using his HWND?

﹥>﹥吖頭↗ 提交于 2020-02-18 21:35:30
问题 I want to check if the window of an external application has the vertical or horizontal scrollbar visible using the HWND (handle) of the window, exist any WinApi function to get this information? I really try the GetScrollInfo function but it seems that not retrieve information about the visibility of the scrollbars. 回答1: How about GetScrollBarInfo with OBJID_HSCROLL or OBJID_VSCROLL If idObject is OBJID_CLIENT and the window specified by hwnd is not a system scroll bar control, the system

Delphi 记录类型- 结构指针

若如初见. 提交于 2020-02-18 09:46:53
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class (TForm) Button1: TButton; Button2: TButton; Button3: TButton; Button4: TButton; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button3Click(Sender: TObject); procedure Button4Click(Sender: TObject); end ; var Form1: TForm1; implementation { $R *.dfm } type TRec = record { 定义结构 TRec } name: string [ 12 ]; age: Word; end ; TPRec = ^TRec; { 定义 TRec 结构的指针类型 TPRec } var Rec: TRec; { 声明结构变量 } PRec1,PRec2: TPRec; { 声明

怎样旋转矢量图形?

血红的双手。 提交于 2020-02-18 09:40:03
怎样旋转矢量图形? Delphi / Windows SDK/API http://www.delphi2007.net/DelphiMultimedia/html/delphi_20061113152916155.html 知道的话,能给发个实例程序(pyxyu@126.com),谢了! 矢量图形??你的矢量图形是如何实现的,想描述一个矢量图,大概有无数种具体实现吧。 如果不清楚他的实现,最笨的办法是先转换成位图,然后根据要旋转的法则逐个象素的复制移动,最后再转换回去。 谁知道,给我也发一份 email : lzd123@126.com thank you ! gdi+轻松实现抗锯齿、缩放、旋转等功能 看看计算机图形学吧。 乘以一个矩阵就可以了。。 直接使用我们的产品吧! TCAD http://www.codeidea.com/cn/ gdi mark 来源: https://www.cnblogs.com/delphi2007/archive/2008/11/05/1326863.html

透过 Delphi 使用二进位金钥做 AES 加密.

徘徊边缘 提交于 2020-02-17 13:56:06
从 1994 年开始,笔者就开始接触加密与网路安全的世界,从鲁立忠老师的指导当中获益良多,后来在台湾的元智大学就读研究所的时候,也以此为研究主题。 在当时,电子商务是显学,Visa跟 Master Card还特别为了网路交易制作了厚厚三大本的商务通讯协定,命名为SET (Secure Electronic Transaction,安全电子交易),从客户端、商店端、银行端定义了绵绵密密的交易规范。 然而,网际网路的世界跟 Visa Master Card所熟悉的专用网路世界差的远了,不是大狗们(Big dogs)说了算,很快的 SSL 128 被吹捧成『最安全的交易保护机制』,每年透过这『最安全的交易保护机制』成交的金额越攀越高。 破解网路而得逞的网路诈欺,始终维持在一个很低的比例,反而从商家端流出的诈欺资料年年创新高,SET也很快的成为一个历史名词。 但是,SET所本的一些加密基础,并没有就此被埋没。X.509电子凭证、RC4, RC5, DES, 3-DES, RSA, SHA-1, SHA256, SHA-2, 还有我们这次要介绍的AES,也不断的推陈出新,在世界上蓬勃发展。这些听了令人打呵欠的主题跟名词,在很多地方都会被用上,只是用了不同的面貌呈现给使用者而已。 像是在台湾的自然人凭证、健保卡里面,都有个人电子凭证(X.509)

Delphi:Exception输出堆栈信息

非 Y 不嫁゛ 提交于 2020-02-16 19:01:11
起源: 用习惯了c#之Exception的StackTrace,在程序出异常crash时候能够以其定位出问题的模块及行号,用回Delphi 2009,发现没有这东西。 显然,在编译环境日新月异的今天,是不科学的。分析Delphi的Exception,发现些线索:StackTrace。 应该有戏! 继续下去,验证输出这个StackTrace,它是空的,里面没有预想要的内容。再深究去,发现并没想象那么容易,它扯到不少蛋。 1、Exception类 Delphi 2009中,StackTrace是如此定义的,与它一起的还有几个var: Exception = class(TObject) private ... protected ... public ... property StackTrace: string read GetStackTrace; property StackInfo: Pointer read FStackInfo; {$IFDEF MSWINDOWS} class var // Hook this function to return an opaque data structure that contains stack information // for the given exception information record. This

Expression illegal in evaluator (& Access Violation)

流过昼夜 提交于 2020-02-16 13:20:15
问题 Im trying to process a plain text file (loaded into a StringList), by using class Tbb2uc but getting AV at calling function GetAddress. TArrayQuotePositions = array[1..4] of integer; Tbb2uc = class(TObject) private Farrayquotes: TArrayQuotePositions; SlInput: TStringList; Inputfilename: TFileName; SlOutput: TStringList; function GetQuotePositions( aLine: string ): TArrayQuotePositions; function GetInvoice( aLine: string ): string; function GetName( aLine: string ): string; function GetAddress