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

Delphi编写变长参数的cdecl函数

文章来自:http://hi.baidu.com/523399/blog/item/f36e2e9b25041fbdc9eaf4c6.html
学过C语言的人都知道,printf的参数是不固定的,这种参数形式叫做变长参数。带有变长参数的函数必须是cdecl调用约定,由函数的调用者来清除栈,参数入栈的顺序是从右到左。printf是根据格式化串中的占位标记来猜测栈中的参数的。以下就用Delphi模拟一个简单的类似printf的函数sprintf。
type
   VA_FN = function(const par1, par2{, ...}: Pointer): Integer; cdecl varargs;
procedure CvtInt;
{ IN:
     EAX:   The integer value to be converted to text
     ESI:   Ptr to the right-hand side of the output buffer:   LEA ESI, StrBuf[16]
     ECX:   Base for conversion: 0 for signed decimal, 10 or 16 for unsigned
     EDX:   Precision: zero padded minimum field width
   OUT:
     ESI:   Ptr to start of converted text (not start of buffer)
     ECX:   Length of converted text
}
asm
         OR       CL,CL
         JNZ      @CvtLoop
@C1:     OR       EAX,EAX
         JNS      @C2
         NEG      EAX
         CALL     @C2
         MOV      AL,'-'
         INC      ECX
         DEC      ESI
         MOV      [ESI],AL
         RET
@


相关文档:

在delphi 2010 上安装 RemObjects 6.0.39.777

作为delphi的铁杆,在正式Delphi2010推出后,我当然也要尝尝新鲜,用电驴下来以后安装。呵呵二十多分钟就搞定了,启动也特快,简单使用一下,棒棒!!看来Delphi(太阳神)又回来了,如是我决定抛弃delphi2007,用这个新家伙。我所用的第三方组件主要是RemObjects和reportbuilder,reportbuilder还没有找到安装forD2009 Ful ......

delphi中使用透明控件的几种方法

有时需要使用透明控件用于捕获鼠标消息
1.调用Windows2000,xp新的API函数实现这一功能的过程。使用SetLayeredWindowAttributes
2.直接设置控件的alphablend,alphablendvalue,间接调用上述api.
3.使用TStaticText控件
procedure WMCtrlColor(var Message: TWMCtlColor); message WM_CTLCOLOR;
procedure TForm3.WMCtr ......

unicode与GB2312转换等Delphi函数


{ 函数 : RESULTSTRING = HexToBin(HEXSTRING)
{ 目的 : 把十六进制字符串转换为二进制字符串
{
{===============================================================}
{ 函数 : RESULTINTEGER = HexCharToInt(HEXCHAR)
{ 目的 : 转换一个十六进制字符为整数
{==================================================== ......

Delphi常用控件命名规范

 常用控件命名前缀
控件类名
前缀
TForm等窗体类 
frm
TButton, TSpeedButton等所有的按钮类 
btn
TCheckBox等所有的检查框 
chk
TRadioButton单选按钮类
rdo
TListBox等所有的列表框类 
lst
TPanel等所有的面板类
pnl
TLabel, TStaticText等所有用来显示的标签类 
lbl
TE ......

一个delphi程序员的开发习惯

                                                   ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号