易截截图软件、单文件、免安装、纯绿色、仅160KB

Delphi + Asm TBits类的学习

技术交流,DH讲解. 在D2010的classes中有个TBits类,这个类主要是位操作的. TBits = class
private
FSize: Integer;
FBits: Pointer;
procedure Error;
procedure SetSize(Value: Integer);
procedure SetBit(Index: Integer; Value: Boolean);
function GetBit(Index: Integer): Boolean;
public
destructor Destroy; override;
function OpenBit: Integer;
property Bits[Index: Integer]: Boolean read GetBit write SetBit; default;
property Size: Integer read FSize write SetSize;
end;
这个类没有什么方法,我们看到了property Bits[Index: Integer]: Boolean read GetBit write SetBit; default;这个属性,就是读取和设置某一位的.

那我们看看它是怎么实现的?
//在类中Eax就是Self指针
procedure TBits.SetBit(Index: Integer; Value: Boolean); assembler;
asm
CMP Index,[EAX].FSize //如果Indx>=Size then 扩容
JAE @@Size
@@1: MOV EAX,[EAX].FBits
OR Value,Value
JZ @@2
BTS [EAX],Index //将Eax中第Index位赋值给CF,然后Eax第index位=1;
RET
@@2: BTR [EAX],Index //将Eax中第Index位赋值给CF,然后Eax第index位=0;
RET
@@Size: CMP Index,0 //if index


相关文档:

在Delphi中解密Magento加密的信用卡号

问题背景:
       公司希望使用Magento来进行接单,而后把订单导入到一个ERP系统中(订单处理引擎)。
问题:
       在使用WebService从Magento中获取Payment信息时,信用卡是被加密的(法律规定不允许在数据库中存储信用卡的明文信息)!
      ......

Delphi 发布ActiveX控件 数字签名(转)

原作者:光明兄弟
最近我正在研究ActiveX技术。我使用Delphi 7创建了一个具有ActiveForm的ActiveX控件应用程序。这个控件产生一个.OCX文件。现在,我需要把这个控件部署在服务器端,在用户浏览网页并选择安装这个控件的时候,用户的IE才会下载、安装并显示这个控件。
但是我的控件必须作数字签名以后,IE才会下载安装。 ......

delphi版MP3切割

好久没写BLOG了,送上一份原创的DELPHI版MP3切割,splitMp3为切割函数,支持按时间切割和按大小切割。望大家支持。
参考VC的资料编写的MP3切割DELPHI版单元.
unit UnitMp3DataUtil;
{
MP3 Cut Unit.
@author Jim Wu
2009-08
}
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, ......

Delphi中的THashTable

在Delphi中,Inifiles单元中有一个TStringHash的类,不过它的Value仅支持Integer(其实也不是问题,有其它类型可以将变量变为Pointer),有点不舒服,今天没事做就把它替换为variant了,其中Key的名称大小写无关,就是为了加快开发速度!
使用Hashtable,查找和删除复杂度都是常数级别的!
type
PPHashItem = ^PHashItem;
......

Delphi定时Showmessage事件

在Delphi中,调用Showmessage后,如何使弹出的对话框在一秒钟后自动关闭,而不用手动去点确定
1:用timer控件的函数
procedure TForm1.Timer1Timer(Sender: TObject);
var
AHandle: THandle;
begin
AHandle := FindWindow('TMessageForm',
PChar(Application.Title));
if AHandle > 0 then
SendMessage( ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号