¹ØÓÚDelphiÖÐDLL·â×°¶ÔÏóµÄ¼¸ÖÖ·½·¨ÕûÀí¼°Ìå»á
ÔÎIJμû£º http://blog.csdn.net/ingener/archive/2007/12/22/1958535.aspx
¹ØÓÚDelphiÖÐDLL·â×°¶ÔÏóµÄ¼¸ÖÖ·½·¨ÕûÀí¼°Ìå»á
DelphiÓÃDLLÀ´·â×°¶ÔÏóµÄ¼¼ÊõÖ÷ÒªÓÐÈýÖÖ:
ÓýӿÚʵÏÖ
Óô¿ÐéºÍ³éÏóÀà·½·¨ÊµÏÖ
ÓÃÀàÒýÓÃʵÏÖ
Ç°Á½ÖÖ£¬¶¼ÊÇÔÚDLLÖÐÉú³ÉÀàʵÀý£»µÚ3ÖÖͨ¹ýÔÚµ÷Ó÷½Éú³ÉʵÀý¡£ÈýÖÖ·½·¨µÄ¹²Í¬¾ÖÏÞÈçÏ£º
µ÷Ó÷½Ö»Äܵ÷Ó÷â×°ÀàÖеÄvirtual·½·¨£»
µ÷Ó÷½ºÍÌṩ·½¶¼±ØÐëÌṩÀàµÄÃèÊö£¬½Ó¿ÚʵÏÖÖÐÐèÒªÌṩ½Ó¿ÚÃèÊö£¨COM·½·¨ÀýÍ⣩£»
²»ÄÜ´´½¨DLL°üº¬¶ÔÏóµÄÅÉÉúÀࣨ½Ó¿ÚÅÉÉú³ýÍ⣩¡£
Ê×ÏÈ£¬ÓýӿÚʵÏÖµ±È»°üÀ¨COMʵÏÖ£¬²»¹ýÓÉÓÚCOMÊÇÒ»ÖÖʵÏÖ½Ó¿Ú¼¼ÊõµÄ¶ÀÁ¢ÃÅÀ࣬ËùÒÔÔÚÏÂÃæ˵µÄ½Ó¿ÚʵÏÖÖв»°üÀ¨Õâ·½ÃæµÄ¶«Î÷¡£Æä´ÎÓô¿ÐéºÍ³éÏóÀà·½·¨ÊµÏÖ£¬ÔÚ¡¶Delphi 6 Developer‘s Guide¡·ÖÐÌá¼°µÄincÎļþ×÷Ϊ¹«ÓõÄÍ·Îļþ£¬ºÍÁõÒÕÔÚ¡¶DelphiÃæÏò¶ÔÏó±à³Ì˼Ïë¡·ÖÐÌá¼°µÄ·½·¨±¾ÖÊÉÏÊÇÒ»ÑùµÄ¡£Î޷Ƕ¼ÊÇΪÁËÔÚµ÷Ó÷½¼ÓÈëabstract¹Ø¼ü×Ö£¬¶øÎÞÐè·½·¨ÊµÏÖ£¬´Ó¶øʹµÃ±àÒëͨ¹ý¡£incÎļþµÄ·½·¨ÊÇÀûÓúêÖ¸ÁîÀ´´ïµ½Í³Ò»´¦Àí£¬²»ÓÃinc·½·¨ÊÇÔÚÁ½´¦¶¼ÐèÒª½øÐÐÃèÊö¡£
ÏÂÃæÓÃÒ»¸öÀý×ÓÀ´Õ¹Ê¾ËùÒÔÉÏÃæÌáµ½µÄ¼¯Öз½·¨¡£
µ÷Ó÷½Ö÷ÒªÎļþÁбíΪ£º
UnitMain.pas µ÷ÓÃDLLµÄ½çÃæ
UnitPublic.pas µÚ¶þÖÖ·½·¨ÔÚµ÷Óö˵ÄÀàÃèÊöÎļþ
UnitIDest.pas ½Ó¿Ú·½·¨ºÍÀàÒýÓ÷½·¨µÄÀàÃèÊöÎļþ
IncDemo.inc ÀûÓÃincÎļþʵÏÖµÄÀàÃèÊöÎļþ
DLL¹¤³ÌÖ÷ÒªÎļþÁбíΪ£º
ProDLLDemo.dpr DLL¹¤³ÌÎļþ
UnitDLLDemo.pas ËùÓÐÀàʵÏÖ²¿·ÖµÄÎļþ
UnitIDest.pas ½Ó¿Ú·½·¨ºÍÀàÒýÓ÷½·¨µÄÀàÃèÊöÎļþ
IncDemo.inc ÀûÓÃincÎļþʵÏÖµÄÀàÃèÊöÎļþ
ÔÚ·½·¨µÄ¹éÄÉÉÏÈçÓÐÒÅ©£¬ÓÐÇëÖ¸½Ì¡£
UnitMain.pas Ô´´úÂ룺
unit UnitMain;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, UnitPublic, UnitIDest;
{$I IncDemo.inc}
// ÓÃÓÚInc·½·¨µÄºêÖ¸ÁÈç¹û²»ÊÇÓø÷½·¨¿ÉÈ¥µôÉÏÃæÄÇÐÐ
type
TfmMain = class(TForm)
Memo1: TMemo;
btnUseAbstract: TButton;
btnUseReference: TButton;
btnUseInterface: TButton;
btnUseInc: TButton;
procedure btnUseAbstractClick(Sender: TObject);
proce
Ïà¹ØÎĵµ£º
Format
typeµÄ¿ÉÄÜÖµÓÐÏÂÁÐÕâЩ£º
(1) d ÓзûºÅÊ®½øÖÆÊý
Args±ØÐëÊÇÓзûºÅÕûÐÍÊý¡£Èç¹ûÔÚ¸ñʽ»¯×Ö·û´®Öл¹¼ÓÈëÁË["." prec]£¬ÔòÈç¹ûArgs
µÄ³¤¶ÈÈç¹ûСÓÚ¸ø³öµÄ¾«¶ÈÊýʱ£¬ÔÚÇ°±ßÌî²¹0£»Èç¹û´óÓÚ¾«¶ÈÊý£¬°´Êµ¼Ê³¤¶ ......
ÏÖÔÚÓ¦ÓÃϵͳÁ÷ÐÐÓÃB/S¿ª·¢£¬Ô缸ÄêÇ°¿ÉÊÇC/SµÄÌìÏÂÄØ£¬ÎÒÏÖÔÚ×öµÄijº½¿Õ¹«Ë¾»õÔ˽áËãά»¤¹¤×÷£¬Æäϵͳ¾ÍÊÇÀûÓÃDelphi¿ª·¢µÄC/SÓ¦ÓóÌÐò£¡ÔÚÈÕ³£µÄά»¤¹¤×÷ÖУ¬ÄÑÃâÒª¶ÔÒѾ×öºÃµÄCOM+×é¼þ½øÐе÷ÊÔ£¬ÒԲ鿴¾ßÌåµÄ´¦ÀíÂß¼£¡±¾ÎľÍÊǽéÉÜÔÚWindowsXP»·¾³ÏÂÈçºÎÔÚDelphiÖе÷ÊÔCOM+×é¼þ£¡
µÚÒ»²½£º¼Ç¼ÏÂÄãÏ£Íûµ÷ÊÔµÄCOM+×é¼þ ......
DELPHI
//////////////////////////////////
Function EncrypKey (Src:String; Key:String):string;
var
idx :integer;
KeyLen :Integer;
KeyPos :Integer; &nbs ......
delphiÖйú¼Ê»¯µÄ¼¸ÖÖ·½°¸¼°±È½Ï(ת)
Ëæ×ÅÈ«Çò»¯³Ì¶È¼ÓÉÈí¼þÔ½À´Ô½ÏñÆѹ«Ó¢£¬µ½´¦Æ®É¢¡¢Ôú¸ù¡£ÕâÆäÖÐÒª½â¾öµÄÊDz»Í¬ÓïÑÔµÄÏÔʾÎÊÌâ¡£ÎÒÃǵ±È»Ï£ÍûÒ»Ì׳ÌÐò£¬¿ÉÒÔ²»Ð޸ĴúÂë¾Í¿ÉÒÔÖ§³Ö²»Í¬µÄÓïÑÔ£¬²»ÒªÈ¥Î¬»¤ºÜ¶àµÄ°æ±¾¡£
Ê×ÏÈҪ̸µ½µÄÒ»¸öÎÊÌâÊÇÂÒÂëÎÊÌ⣬ÒòΪdelphi
wi ......
DelphiÖÐFormat×Ö·û´®ËµÃ÷
function Format(const Format: string; const Args: array of const):
string;
Format×Ö·û´®ËµÃ÷£º
"%" [index ":"] ["-"] [width] ["." prec] type
(1)
¸ñʽ»¯×Ö·û´®±ØÐëÒÔ%¿ªÍ·
(2) [index ":"]
Ë÷ÒýÖ¸µÄÊÇArgs²ÎÊýÁбíÖÐÒªÏÔʾµÄÿһÏîµÄÐòºÅ¡£±ÈÈ磺ArgsÊÇ
......