delphiÖÐSynchronize
delphiÖÐSynchronizeÕâ¸ö¶«¶«ÓÐʲôÓã¿ÎÒÖªµÀÊÇÏß³Ìͬ²½Ê¹ÓõÄ
ÊÇ·ñÊÇÒ»¸öº¯Êý»ò±äÁ¿£¬µ±Ò»¸öÏß³ÌÔÚʹÓÃʱ£¬Èç¹ûÕâ¸öº¯ÊýʹÓÃÁËSynchronizeÐÞîߵĻ°¾Í²»ÔÊÐí±ðÒ»¸öÏß³ÌÀ´µ÷ÓÃÕâ¸öº¯Êý
1Â¥£º±ðµÄÏ̻߳áµÈ´ý¸Ã²Ù×÷Íê³Éºó²ÅÄܼÌÐø
2Â¥£ºÄã˵µÄ»ù±¾ÊÇÕâ¸öÒâ˼¡£ËüµÄÄ¿µÄÊDZÜÃâ¶à¸ö×ÓÏß³Ìͬʱ·ÃÎÊÖ÷Ïß³Ì×ÊÔ´¡£
ʾÀý£º
procedure ServerThread.ListItemEnd; //×ÓÏ̵߳ÄÒ»¸ö·½·¨
begin
if (ListItem <> nil) then
ListItem.SubItems.Strings[3] := '´«ËÍÍê±Ï'; //ListItemÊÇÖ÷Ï̵߳ÄÒ»¸öTreeViewµÄÒ»ÐÐ
end;
procedure ServerThread.ClientExecute; //×ÓÏß³ÌÖ´ÐÐ
begin
Synchronize(ListItemEnd);
//Èç¹ûÖ±½ÓдListItemEnd£¬¿ÉÄÜ·¢Éú³åÍ»¡£
end;
—————————————————————————————————
MaximStr := '³èÈè²»¾ª£¬¿´Í¥Ç°»¨¿ª»¨Â䣬ȥÁôÎÞÒ⣻
»ÙÓþÓÉÈË£¬ÍûÌìÉÏÔƾíÔÆÊ棬¾ÛÉ¢Èη硣';
if Not Assigned(I) then
I := TI.Create(Nil);
I.Maxim := MaximStr;
I.Explain := '¼ÙÈçÉÏÊö´úÂëÖгöÏÖ“OA”µÈ×ÖÑù£¬É¾³ýËüÃÇ';
I.Desire := '¼Ó²»¼Ó·ÖËæÄã';
—————————————————————————————————
¡¡¡¡¡¡¡¡¡¡
3Â¥£ºµ±´´½¨Á˶à¸öỊ̈߳¬²¢ÇÒ¶à¸öÏ̶߳¼Òª·ÃÎÊͬһ×ÊÔ´£¬£¬¾ÍÓпÉÄܳöÏÖ»ìÂÒ£¬ÓÚÊÇÓÃSynchronizeÀ´¿ØÖÆ£¬Ê¹Í¬Ò»Ê±¼äÖ»ÓÐÒ»¸öÏß³ÌʹÓÃÄDz¿·Ö×ÊÔ´£¬Synchronize²ÎÊýÀïÃæµÄ´úÂë¾ÍÊǶàÏß³ÌÐèÒª¹«¹²µÄ´úÂ룡
4Â¥£º1¡£synchronize·½·¨µÄ²úÉúÓëvclµÄ¾ÖÏÞÐÔÓйØ,ÒòΪvcl¿Ø¼þÔÚͬһʱ¿ÌÖ»Äܱ»µ¥Ï̷߳ÃÎÊ£¬Èç¹û¶à¸öÏß³Ìͬʱ·ÃÎÊvcl,vcl»á³öÏÖÎÊÌâ¡£ËùÒÔÎÊÁË°²È«µØ·ÃÎÊvcl,TthreadÀàÌṩÁËÒ»¸ö·½·¨½Ðsynchronize£¬Ëû¿ÉÒÔÈÃÏß³ÌÖеķ½·¨ÔÚÖ÷Ïß³ÌÖÐÖ´ÐУ¬ËùÒÔÎÒÃÇ¿ÉÒÔ°Ñ·ÃÎÊvclµÄ´úÂ붼·ÅÔÚÕâ¸ö·½·¨ÖУ¬È»ºóÓÉÖ÷Ïß³ÌÖ´ÐУ¬´Ó¶øÈ·±£vclÄܱ»°²È«µØ·ÃÎʵ÷ÓÃ.ËüµÄÀàÐÍÊÇTThreadMethod=procedure of object;procedure ²ÎÊý:Sychronize(Method:TThreadMethod);
2¡£µ±´´½¨Ò»¸öÏß³Ìʱ£¬vcl»áÔ
Ïà¹ØÎĵµ£º
Delphi¿½±´Ä¿Â¼(º¬×ÓĿ¼)µÄ·½·¨
ҪʵÏÖĿ¼¼¶µÄ¿½±´£¬¿ÉÒÔÀûÓÃWindows APIº¯ÊýShFileOperation( )£¬Æ亯ÊýÉùÃ÷ÈçÏ£º
WINSHELLAPI int WINAPI SHFileOperation(
LPSHFILEOPSTRUCT lpFileOp
);
ʵÀý£º
н¨Ò»¸ö¹¤³Ì£¬Æä³ÌÐòʾÀýÈçÏ£º
unit Unit1;
interface
uses
Windows, Messag ......
ÔÚDelphiÓ¦ÓóÌÐòÖÐʹÓÃDLL
¡¡¡¡Delphi²»½ö¿Éµ÷ÓÃC£«£«²úÉúµÄDLLÄ£¿é£¬Í¬ÑùC£«£«³ÌÐòÒ²¿Éµ÷ÓÃDelphiËù²úÉúµÄDLL²¿¼þ¡£ÕâÑù½»»¥µ÷Óã¬ÎÞÐëÖظ´¿ª·¢£¬´ó´óËõ¶ÌÁËÉú²úÖÜÆÚ¡£
¡¡¡¡DelphiÓëVisualBasic¡¢VisualFoxProµÈÈí¼þÒ»Ñù£¬ÊôÓÚRAD¹¤¾ß£¨¿ìËÙÓ¦Óÿª·¢¹¤¾ß£©¡£ÊʺϿª·¢32λ»ò16λ£¯32λ»ìºÏÓ¦ÓóÌÐò¡£DelphiËùÊ¹Ó ......
¶¯Ì¬Á´½Ó¿âÊÇÒ»¸öÄܹ»±»Ó¦ÓóÌÐòºÍÆäËüµÄDLLµ÷ÓõĹý³ÌºÍº¯ÊýµÄ¼¯ºÏÌå,ËüÀïÃæ°üº¬µÄÊǹ«¹²´úÂë»ò×ÊÔ´¡£ÓÉÓÚDLL´úÂëʹÓÃÁËÄÚ´æ¹²Ïí¼¼Êõ,ÔÚijЩµØ·½windowsÒ²¸øÁËDLLһЩ¸ü¸ßµÄȨÏÞ,Òò¶øDLLÖпÉÒÔʵÏÖһЩһ°ã³ÌÐòËù²»ÄÜʵÏֵŦÄÜ,ÈçʵÏÖwindowsµÄHOOK¡¢ISAPIµÈ¡£Í¬Ê±,DLL»¹Îª²»Í¬ÓïÑÔ¼ä´úÂë¹²ÏíÌṩÁËÒ»Ìõ·½±ãµÄ;¾¶¡£Òò¶øD ......
Client:TSocketConnection ºÍServer: Scktsrvr¹Øϵ----ѹËõÊý¾Ý´«Êä
Ò»Ö±ÓÃSocketConnectionºÍ·þÎñ¶ËµÄ´«ÊäÊý¾ÝÔÚÈý²ãÊý¾Ý¿âÖУ¬´ÓÀ´Ã»ÓÐ×¢Òâµ½ËüÃÇÖ®¼äµÄÊý¾Ý´«Ê䣬ֻÊÇÏë×Å£¬¹ÜËüÁË£¬ÍøÂçµÄÊ£¬Ç°¶Îʱ¼äÔÚDelphiÖеÄDemosÖз¢ÏÖDemos\Midas\Intrcpt.dprÀý×Ó£¬ºÇºÇ£¬ÔÙ¿´ÁË°ëÌìµÄVCL·¢ÏÖ¿ÉÒÔ½«Client¶Ë·¢Ë͵ĸøServerµÄÊ ......
ÉèÓÐÒÔÏÂÈý¸ö±äÁ¿£º
var
s:string;
p:pchar;
a:array[1..20] of char;
ÄÇôÈýÕßÖ®¼äµÄת»»ÈçÏ£º
1¡¢×Ö·û´®µ½PChar
p:=PChar(s);
2¡¢PCharµ½×Ö·û´®
s:=p;
3¡¢PCharµ½×Ö·ûÊý×é
StrCopy(@a,p);
4¡¢×Ö·ûÊý×éµ½PChar
......