Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Delphi Assigned


1.¸ù¾Ý Delphi Ö¸Áî²Î¿¼ÊÖ²áÖÐ
˵Ã÷£º
Assigned º¯Ê½ÔÚ²ÎÊý²»Îªnilʱ´«»ØTrue,±íʾָÕëÒѾ­Ö¸µ½Ä³¸öÄÚ´æµØÖ·£¬Õâ¸öÄÚ´æµØÖ·¿ÉÄÜÊÇÒ»¸ö¶ÔÏóµØÊ×µØÖ·£¬Ò²¿ÉÄÜÔÚº¯Êý»ò¹ý³ÌÖУ¬ÉùÃ÷Ò»¸öÖ¸Õë±äÁ¿£¬Ã»Óи³ÖµÎªnil £¬ÎÞÂÒµÄÖ¸Ïòij´¦£¬ÕâÁ½¸öÖÖÇé¿ö£¬Assigned£¨Ö¸Õë±äÁ¿£©¶¼²»Îªnil , º¯Êý·Å»ØTrue£»
¶ø²ÎÊýΪnilʱÔò´«»ØFalse¡£
Assigned ²¢²»ÊÇÒ»¸öÕæÕýµÄº¯Êý¡£
¼¼ÇÉ£º
Óúô½Ð Assigned µÄ·½Ê½À´È¡´úÖ±½Ó°Ñ²ÎÊýÄÃÀ´ºÍnil±È½Ï£¬Ð§ÂÊ»á¸üºÃ¡£
 
2.Õâ¸öÎÊÌâÒª´ÓÄÚ´æ·½ÃæÀ´½âÊÍ
µ±Ä㽨¹¹Ò»¸öÎï¼þ SomeComponet.Create(Owner);
ϵͳ»áÓÐÒ»¸öÖ¸ÕëÖ¸ÏòÕâ¸ö¶ÔÏó
µ±Äã½â¹¹Ò»¸öÎï¼þ SomeComponet.Free;
ϵͳ»á½«Ö¸ÕëÖ¸µ½µÄ¶«Î÷ɱµô£¬µ«ÊÇÖ¸±ê»¹ÊÇÖ¸ÔÚÏàͬµÄλÖÃ
Çë×¢Òâ¼ÆËã»úµÄ×ÊÔ´ÊÇÓÐÏ޵ģ¬
ËùÒÔ¿ÉÄÜÏÂÒ»²½ÄãµÄ³ÌÐòÒª¸úϵͳҪ×ÊÔ´£¬
¸Õ²ÅµÄÖ¸ÕëλÖ㬾ͳöÏÖÁËÆäËüµÄÊý¾Ý
If Assigned(SomeComponet) then SomeComponet := nil;
Ïȼì²éÕâ¸ö¶ÔÏóÓÐûÓÐÔÚÆäËüµØ·½±»Éè³É nil£¬
È»ºóÔÙ½«ËüÉè³É nil ¡£
µ±ÎÒÃÇÎÞ·¨Ô¤²âʹÓÃÕß»áÈçºÎ²Ù±¬ËûµÄ¼ÆËã»ú£¬
³ÌÐòÔ±±ØÐëÁôÒâÄÚ´æµÄ¹ÜÀí¡£ СµÜdz¼û...
3
function Assigned(var P): Boolean;
Description
Use Assigned to determine whether the pointer or procedure referenced by P is nil. P must be a variable reference of a pointer or procedural type. Assigned(P) corresponds to the test P<> nil for a pointer variable, and @P <> nil for a procedural variable.
Assigned returns False if P is nil, True otherwise.
¼ì²éÖ¸ÕëÖ¸ÏòµÄ²Î¿¼±äÁ¿»ò¹ý³ÌÊÇ·ñΪnil
ÿ´ÎÎÒͨ³£µÄ´¦Àí·½·¨¶¼ÊÇ£º
if assigned(frm) then frm.close;   µ«Êǵ±Ï´ε÷ÓÃʱ¾Í»á³ö´í¡£ÎªÊ²Ã´ÄØ£¬Ö±µ½Õ¦ÌìÎÒ²ÅÖªµÀÔ­Òò
frm.close;frm.free; Ö»ÊÇÖ¸¶¨Õâ¿éÄÚ´æ¿ÉÒÔÖØд£¬²¢Î´ÊÍ·ÅΪNIL Òò´Ëµ±Ï´ε÷ÓÃʱ¼´Ê¹frm.freeÒѾ­
Ö´Ðйýassigned(frm)ÈÔΪTRUE£¬ÔÙ´ÎÊÍ·Å frm.Close »òÕß frm.free ¿Ï¶¨»á±¨´í£»Ó¦Îªfrm.Close»òfrm.free ÊÇÊÍ·Å ¶ÔÏóÖ¸Õëfrm Ö¸ÏòµÄÄÚ´æ¿Õ¼ä£¬ÔÚÉÏ´ÎÒѾ­Êͷŵ÷ÁË£¬µ«ÊÇ frm ±¾Éí²¢Ã»ÓÐ ³õʼ»¯Îª nil ,Ïà·´Ëü»¹ÊÇÖ¸Ïò±»ÊͷŵÄÄÚ´æµØÖ·£»¶«Î÷ÒѾ­Ã»ÓÐÁË£¬Ã»Óеض«Î÷È¥ÊÍ·Å£¬²»±¨´í´í²Å¹Ö¡£
ÕýÈ·µÄ´¦Àí·½·¨£º
if assigned(frm) then
begin
   frm.close;
   frm:=nil;
end;
»ò:
if assigned(frm) then
begin
frm.close;
freeandnil(fr


Ïà¹ØÎĵµ£º

Delphi Öн«¶ÔÏó×÷Ϊ²ÎÊý´«µÝµÄʹÓÃ

Delphi Öн«¶ÔÏó×÷Ϊ²ÎÊý´«µÝµÄʹÓà ¾ÙÀý·ÖÎö
2009-07-24 13:40
 
ÏÂÃæµÄµ¥»÷ʼþ£¬½«Òªµ÷ÓÃÒ»¸öÒÔ¶ÔÏóΪ²ÎÊýµÄ·½·¨£¬²¢½«½á¹ûÏÔʾ³öÀ´¡£
procedure TForm1.btn1Click(Sender: TObject);
var
lStrings: TStrings;
begin
lStrings:= TStringList.Create;
try
    lStrings.Add('chen');
&nbs ......

Delphi¿ØÖÆExcel2000ÐĵÃ

(Ò») ʹÓö¯Ì¬´´½¨µÄ·½·¨
Ê×ÏÈ´´½¨ Excel ¶ÔÏó£¬Ê¹ÓÃComObj:
var ExcelApp: Variant;
ExcelApp := CreateOleObject( 'Excel.Application' );
1) ÏÔʾµ±Ç°´°¿Ú£º
ExcelApp.Visible := True;
2) ¸ü¸Ä Excel ±êÌâÀ¸£º
ExcelApp.Caption := 'Ó¦ÓóÌÐòµ÷Óà Microsoft Excel';
3) Ìí¼Óй¤×÷²¾£º
ExcelApp.WorkBooks.Add ......

Delphi±éÀúPanel×é¼þÉϵÄËùÓпؼþ

procedure frmMain.CLS; //Ö÷´°Ìå×Ô¶¨ÒåʼþCLS
var i:integer;
begin
  for i:=0 to panel5.ControlCount -1 do
  begin
    if panel5.Controls[i] is TEdit then  //Edit×é¼þ
    begin
       ((panel5.Contro ......

ʹÓÃDelphiµ÷ÓÃWebServices½Ó¿ÚµÄ¼òµ¥Ó¦ÓÃʵÀý


Delphi´Ó6.0¾Í¿ªÊ¼Ö§³ÖWeb ServicesµÄ¿ª·¢ºÍÓ¦ÓÃÁË£¬±¾ÎÄͨ¹ýʹÓÃDelphi 7.0µ÷ÓÃÐÂÀË·¢ËͶÌÐŵÄWeb Service½øÐжÌÐÅÓ¦ÓóÌÐò¿ª·¢ÕâһʵÀýÏêϸµÄ½éÉÜÔÚDelphiÖÐÈçºÎ¿ª·¢»ùÓÚWeb ServicesµÄÓ¦ÓÃϵͳ¡£
µÚÒ»²½£¬×¼±¸¹¤×÷£¬Á˽âÐÂÀ˶ÌÐÅWeb Service¡£ÐÂÀË·¢ËͶÌÐŵÄWeb ServiceµØÖ·ÊÇhttp://smsinter.sina.com.cn/ws/smswebs ......

Delphi 쵀RTTI

Ŀ¼
===============================================================================
¡Ñ RTTI ¼ò½é
¡Ñ Àà(class) ºÍ VMT µÄ¹Øϵ
¡Ñ Àà(class)¡¢ÀàµÄÀà(class of class)¡¢Àà±äÁ¿(class variable) µÄ¹Øϵ
¡Ñ TObject.ClassType ºÍ TObject.ClassInfo
¡Ñ is ºÍ as ÔËËã·ûµÄÔ­Àí
¡Ñ TTypeInfo – RTTI ÐÅÏ¢µÄ½ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ