Delphi

Delphi 2010: How to save a whole record to a file?

你离开我真会死。 提交于 2020-02-09 01:09:09
问题 I have defined a record which has lots of fields with different types (integer, real , string, ... plus dynamic arrays in terms of "array of ..."). I want to save it as a whole to a file and then be able to load it back to my program. I don't want to go through saving each field's value individually. The file type (binary or ascii or ...) is not important as long Delphi could read it back to a record. Do you have any suggestions? 回答1: You can load and save the memory of a record directly to

Delphi 2010: How to save a whole record to a file?

白昼怎懂夜的黑 提交于 2020-02-09 01:08:57
问题 I have defined a record which has lots of fields with different types (integer, real , string, ... plus dynamic arrays in terms of "array of ..."). I want to save it as a whole to a file and then be able to load it back to my program. I don't want to go through saving each field's value individually. The file type (binary or ascii or ...) is not important as long Delphi could read it back to a record. Do you have any suggestions? 回答1: You can load and save the memory of a record directly to

Implement override for thread Terminate method

回眸只為那壹抹淺笑 提交于 2020-02-08 10:02:47
问题 I am trying to override the virtual TThread::Terminate method, but am finding my override gets called only after the Terminated flag is set. What is the correct way to implement this? TTestThrd = class(TThread) private { Private declarations } protected { Protected declarations } procedure Execute(); override; procedure DoTerminate(); override; public { Public declarations } end; procedure TTestThrd.Execute(); var bTerminated: Boolean; begin // This is the main thread loop try while (not

问题-[Delphi]提示Can't load package:dclite70.bpl解决方法

霸气de小男生 提交于 2020-02-08 08:04:02
问题现象: 提示Can't load package:dclite70.bpl 问题原因: 全是Window2003的Data Execution Prevention(DEF数据执行保护)造成的。 解决方法: win2003server SP1 + delphi7 ,在启动DELPHI时会提示Can't load package:dclite70.bpl,进入后打开Options时出现异常。 解决方法: 右击“我的电脑”。单击“属性”。 在“系统属性”中单击“高级”。 在“性能”中单击“设置”。 在“性能选项”中单击“数据执行保护”。 单击“添加”。选择Delphi7安装目录,然后到Bin目录下选择Delphi32.exe。 应用重启DELPHI即可。 PS: 引用 数据执行保护 (DEP) 是 Microsoft Windows XP Service Pack 2 (SP2) /Windows2003支持的一种处理器功能,它禁止在标记为数据存储的内存区域中执行代码。此功能也称作“不执行”和“执行保护”。当尝试运行标记的数据页中的代码时,就会立即发生异常并禁止执行代码。这可以防止攻击者使用代码致使数据缓冲区溢出,然后执行该代码。数据执行保护 (DEP) 有助于防止病毒和其他安全威胁造成破坏,它们的攻击方法是从只有 Windows 和其他程序可以使用的内存位置执行恶意代码。

Hotel prices spanning multiple dates issue

霸气de小男生 提交于 2020-02-08 06:53:43
问题 Question is somehow related to this one, with the exception that I use parameters. I have this on my button click : procedure TForm1.Button1Click(Sender: TObject); begin with ABSQuery1 do begin ABSQuery1.Close; ABSQuery1.SQL.Clear; ABSQuery1.SQL.Add('select * from ROOM_RATES where CENIK_ID = :a4 and ROOM_TYPE = :A1'); ABSQuery1.SQL.Add('and rate_Start_DATE < :a3 AND rate_End_DATE > :a2 ORDER BY rate_Start_DATE ASC '); ABSQuery1.Params.ParamByName('a1').Value:= cxLookupComboBox2.Text;

使用delphi生成二维码图像

↘锁芯ラ 提交于 2020-02-07 19:55:46
由于项目需要,最近找了不少关于二维码生成的方法。有zxing,有一些dll,OCX之类的。最后在git上找到了pxQRcode这个项目。 下载pxQRcode.pas后使用demo中的方法,可以生成二维码,但是,手机不能识别。研究了半天,做如下改动: 第23行: QR_DEFAULT_MASK = 2; 改为: QR_DEFAULT_MASK = 0; 就可以了。 我是用在打印里面的,使用的是QuickReport 使用方法: 新建一个QRimage1:TQRImage,QRLabel1:TQRLabel procedure TFormPrint.FormShow(Sender: TObject); var ms: TMemoryStream; s2: string; i: Integer; begin ms := TMemoryStream.Create; try s2 := QRCode; QRLabel1.Caption:=s2; CreateQRCodeBMP(s2, ms, QR_ECLEVEL_H, 10); ms.Position := 0; QRImage1.Picture.Bitmap.LoadFromStream(ms); finally ms.Free; end; end; 来源: https://www.cnblogs.com/csaaa/p

Delphi支付宝支付SDK【支持SHA1WithRSA/RSA和SHA256WithRSA/RSA2签名与验签】D7~XE10可用

与世无争的帅哥 提交于 2020-02-07 15:35:04
作者QQ:(648437169) 点击下载➨ Delphi支付宝支付 支付宝支付api文档 【Delphi支付宝支付】支持条码支付、扫码支付、交易查询、交易退款、退款查询、交易撤销、交易关闭、交易结算、账户转账、转账查询、对账单下载、SHA1WithRSA(RSA)和SHA256WithRSA(RSA2)签名与验签,D7~XE10可用 用delphi做支付宝支付说实在坑有点多,网上资料太少,官网更不要去奢望有SDK,阿里在线技术客服很多的连delphi都没听说过,只能靠自己仿佛阅读API文档,该demo我大概用了有四五天的时间去写,特别是验签花费的时间太多了! 来源: https://www.cnblogs.com/zhimamaigua/p/10882389.html

Callback from Firemonkey WebBrowser JavaScript code

我怕爱的太早我们不能终老 提交于 2020-02-07 06:44:20
问题 How to make call of Firemonkey code (callback) from JavaScript code in TTMSFMXWebBrowser? I can perform JavaScript code from Firemonkey, but how I can make a callback or call Firemonkey code/event from JavaScript? Is it possible? 回答1: So in the URL you can pass a custom string or whatever data like this: myurl://dostuff?a=b&c=d if (Copy(S, 1, 8)='myurl://') then begin // now you know it is a callback and not a real URL // if it is a callback you can cancel the load using the below code // and

Callback from Firemonkey WebBrowser JavaScript code

南楼画角 提交于 2020-02-07 06:42:17
问题 How to make call of Firemonkey code (callback) from JavaScript code in TTMSFMXWebBrowser? I can perform JavaScript code from Firemonkey, but how I can make a callback or call Firemonkey code/event from JavaScript? Is it possible? 回答1: So in the URL you can pass a custom string or whatever data like this: myurl://dostuff?a=b&c=d if (Copy(S, 1, 8)='myurl://') then begin // now you know it is a callback and not a real URL // if it is a callback you can cancel the load using the below code // and

Callback from Firemonkey WebBrowser JavaScript code

妖精的绣舞 提交于 2020-02-07 06:42:08
问题 How to make call of Firemonkey code (callback) from JavaScript code in TTMSFMXWebBrowser? I can perform JavaScript code from Firemonkey, but how I can make a callback or call Firemonkey code/event from JavaScript? Is it possible? 回答1: So in the URL you can pass a custom string or whatever data like this: myurl://dostuff?a=b&c=d if (Copy(S, 1, 8)='myurl://') then begin // now you know it is a callback and not a real URL // if it is a callback you can cancel the load using the below code // and