ÓÃdelphiÖÆ×÷OCX¿âÎļþ£¨Èý£©
¿ª·¢²½Ö裺
1¡¢´´½¨ActiveX Library¹¤³Ì¡£
2¡¢´´½¨COM Object¡£
3¡¢´´½¨Type Library£¬²¢´´½¨ÏàÓ¦½Ó¿Ú¡£
4¡¢´´½¨½Ó¿Ú¶ÔÓ¦µÄº¯ÊýºÍʵÏÖ¡£
¾ßÌåÈçÏ£º
3¡¢´´½¨Type Library£¬²¢´´½¨ÏàÓ¦½Ó¿Ú¡£
view|type library
ÕÒµ½ÒѾÉú³ÉµÄtype library,ÆäʵºÍTLBÎļþÊǶÔÓ¦µÄ¡£
ÎÒÃÇ¿ÉÒÔ¿´µ½ÉÏÒ»²½Éú³ÉµÄ¶ÔÏóÒ²º¬ÔÚÀïÃæ¡£
ÎÒÃÇÔÚÀïÃæÉú³Éеķ½·¨£¬²¢¶¨ÒåºÃ·½·¨µÄ²ÎÊý¡£
×¢Ò⣺integerºÍStringÔÚOCXÀï¶ÔÓ¦µÄÀàÐÍ·Ö±ðΪlongºÍBStr»òÕßWideString¡£Ä¿µÄÊÇΪÁ˱ãÓÚÍøÂçÉÏ´«²¥Ê±¸÷¸öϵͳ¼æÈݵÄÐèÒª¡£
·µ»ØÖµ±ØÐëΪָÕëÀàÐÍ£¬ModifierΪ·µ»Ø±êÖ¾£¬[in]ΪÊäÈë²ÎÊý£¬[out,RetVal]ΪÊä³ö¼Ó·µ»ØÖµ¡£
ÔÚClass Name(±¾ÀýÀïÀàÃûÀïÌîObject£¬¿É°´×Ô¼ºÐèÒªÌîд) ÌîдÀàÃû.(Instancing:ʵÀý´´½¨·½Ê½,Threading Model:Ïß³Ìģʽ.) Æä
ÖÐImplemented Interface(½Ó¿ÚÃû)×Ô¶¯Éú³É.
µãˢа´Å¥Ö®ºó£¬ÔÚTLBºÍʵÏÖµ¥ÔªÀﶼÓÐÁ˹ØÓÚÕâ¸ö½Ó¿Úº¯ÊýµÄ¶¨Òå¡£
ʣϵÄÖ»ÒªÔÚʵÏÖµ¥ÔªÀïÍê³ÉʵÏֵĴúÂë¼´¿É¡£
4¡¢´´½¨½Ó¿Ú¶ÔÓ¦µÄº¯ÊýºÍʵÏÖ¡£
¾ßÌåʵÏÖ¡£
type
TOjbect = class(TTypedComObject, IOjbect)
protected
function Method1(Param1, Param2: Integer; out Param3: Integer): HResult;
stdcall;
end;
implementation
uses ComServ;
function TOjbect.Method1(Param1, Param2: Integer;
out Param3: Integer): HResult;
begin
//¾ßÌåʵÏÖ
end;
Ïà¹ØÎĵµ£º
±Ï¾¹Win32³ÌÐòµÄ¿ª·¢£¬Delphi»¹ÊÇÓÐÍçÇ¿µÄÉúÃüÁ¦µÄ¡£
²Ù×÷²½ÖèÈçÏ£º
1.½¨Á¢ res Îļþ
½¨Á¢Ò»¸öÎı¾Îļþ£¬Ãû×Ö¿ÉÒÔ×Ô¼ºÆð£¬ÎÒÕâÀï½Ð£ºUAC.manifest£¬ÄÚÈÝ£º
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
......
ÎÒÃÇÄÜ¿´µ½ÒÔÏ´úÂë
var pSource,pDest:PChar;
len: integer;
.......................//һЩ´úÂë
Move(pSource,pDest,len); //´íÎó
Move(pSource^,pDest^,len); //ÕýÈ·
¿´ÆðÀ´È·ÊµºÃÏñÊÇ´«Öµ£¬¶ø²»ÊÇ´«µØÖ·£¬µ«ÊǸ÷λ±ðÍüÁË£¬Õâ²»ÊÇC£¬C++£¬¶øÊÇDelphi
Object Pascal,ËùÒÔ£¬¾ø²»ÄÜ´Óº¯Êýµ ......
Ò»¡¢Ê¹ÓÃÎļþÁ÷µÄ·½·¨½øÐп½±´£¬µ±È»¡£Í¬ÑùµÄµÀÀí£¬ÄãÒ²¿ÉÒÔʹÓÃÄÚ´æÁ÷µÈ·½·¨½øÐÐÎļþµÄ¿½±´£¬ÔÀíÊÇÒ»ÑùµÄ¡£
procedure copyfile(sourcefilename,targetfilename : String);
var f1, f2: tfilestream;
begin
f1 := tfilestream.Create(sourcefilename, fmopenread);
try
f2 := tfilestream ......
ÓÉÓÚ×é¼þÌṩµÄ·½Ê½²»Í¬£¬ËùÒÔ°²×°µÄ·½·¨Ò²ÊDz»Ò»ÑùµÄ£¬ÏÂÃæ¾ÍÄ¿Ç°³£¼ûµÄ¸÷ÖÖÐÎʽµÄ×é¼þµÄ°²×°·½·¨½éÉÜһϡ£
1 Ö»ÓÐÒ»¸öDCUÎļþµÄ×é¼þ¡£DCUÎļþÊDZàÒëºÃµÄµ¥ÔªÎļþ£¬ÕâÑùµÄ×é¼þÊÇ×÷Õß²»Ïë°ÑÔ´Â빫²¼¡£Ò»°ãÀ´Ëµ£¬×÷Õß±ØÐë˵Ã÷´Ë×é¼þÊʺÏDelphiµÄÄÄÖÖ°æ±¾£¬Èç¹û°æ±¾²»¶ ......
// ÅжÏÊÇ·ñÊÇÊýÖµÐÍ By yangxiao 2007.7.21
function isNumeric(strText: WideString): Boolean;
var
s: string;
i, l, p: Integer;
begin
Result := False;
l := Length(strText);
if l = 0 then Exit;
s := '';
for i:=1 to l do
......