¹ØÓÚdelphi Assigned
¹ØÓÚ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
Ïà¹ØÎĵµ£º
ʵ¼ÊÉÏÕâ¸öÃû×Ö½Ð[SDL & Delphi]Ò²²»³ÉÎÊÌ⣬ ÒòΪ³ýÁËDelphiËÆºõҲûÓÐÄĸöÁ÷ÐеĿª·¢¹¤¾ßÓõÄÊÇPascalÓïÑÔ¡£
SDLÆäʵÎÒҲֻѧÁ˲»µ½Á½ÐÇÆÚ¶øÒÑ¡£¸Õ¿ªÊ¼ÎÒÏëÊÔͼÓÃVC£¬ÒòΪÕâÑù×ÊÁÏ×îÈ«£¬Ò²ºÜºÃÕÒ£¬µ«Ì«¾ÃûÓÃVCÏÖÔÚ¿´CµÄ´úÂëÓеãÀ§ÄÑ£¨->Õâ¸öËã·ûÊǸÉÂðµÄÀ´×Å……£©¡£Æäʵ×÷Ϊһ¸öרҵ²»ÊǼÆËã»úµÄÈË ......
ÈçºÎµ÷ÊÔDLL£¬ÔÚÕâÀï¾Í²»ÔÙ׸ÊöÁË£¬µ«ÊÇ£¬½ñÌì¾ÍÅöµ½ÁËÒ»¸öÌØ±ðÆæ¹ÖµÄÎÊÌ⣬²ÎÊýÉèÖÃÕýÈ·£¬¾ÍÊDz»Äܵ÷ÊÔ£¿£¿ ͨ¹ýÉÏÍø²é×ÊÁÏ£¬·¢ÏÖÁËÎÊÌ⣬עÒ⣺
1£¬ ½«ProjectÖ÷²Ëµ¥µÄProject Options¶Ô»°¿òµÄCompilerÒ³ÃæDebuggingÑ¡ÏîÖÐµÄ Debug informaton¡¢Local symbols¡¢Assertions¸´Ñ¡¿òÑ¡ÖÐ
2£¬½«ToolsÖ÷²Ëµ¥µÄD ......
ÓÃDelphi ʵÏÖ´®¿ÚͨѶ£¬³£Óõļ¸ÖÖ·½·¨Îª£ºÊ¹ÓÿؼþÈçMSCOMMºÍSPCOMM£¬Ê¹ÓÃAPIº¯Êý»òÕßÔÚDelphi Öе÷ÓÃÆäËü´®¿ÚͨѶ³ÌÐò¡£ÀûÓÃAPI±àд´®¿ÚͨÐųÌÐò½ÏΪ¸´ÔÓ£¬ÐèÒªÕÆÎÕ´óÁ¿Í¨ÐÅ֪ʶ£¬ÆäÓŵãÊÇ¿ÉʵÏֵŦÄܸüÇ¿´ó£¬Ó¦ÓÃÃæ¸ü¹ã·º£¬¸üÊʺÏÓÚ±àд½ÏΪ¸´ÔÓ µÄµÍ²ã´ÎͨÐųÌÐò¡£Ïà±È½Ï¶øÑÔ£¬ÀûÓÃSPComm¿Ø¼þÔòÏà¶Ô½Ï¼òµ¥£¬¸Ã¿Ø¼þ¾ßÓ ......
DelphiÌṩµÄ×Ö·û´®º¯ÊýÀïÓÐÒ»¸öPosº¯Êý£¬ËüµÄ¶¨ÒåÊÇ£º
function Pos(Substr: string; S: string): Integer;
ËüµÄ×÷ÓÃÊÇÔÚ×Ö·û´®SÖвéÕÒ×Ö·û´®Substr£¬·µ»ØÖµÊÇSubstrÔÚSÖеÚÒ»´Î³öÏÖµÄλÖã¬Èç¹ûûÓÐÕÒµ½£¬·µ»ØÖµÎª0¡£
ʹÓÃposº¯ÊýÀ´²éÕÒ×Ö·ûµÚÒ»´Î³öÏÖµÄλÖÃ
var
str1:string;
i,j:integer;
begin
str1:='dsf465 ......
ÐèÒªÓõ½µÄÒ»¸öº¯Êý£º
LONG SetWindowLong(
HWND hWnd,
int nIndex,
LONG dwNewLong
);
ÆäÖÐnIndex GWL_EXSTYLE Retrieves the extended window styles.
dwNewLong WS_EX_TOOLWINDOW Creates a tool window; that is, a window intended to ......