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

Delphi¶àÏß³Ìѧϰ£¨6£©£ºÐźÅÁ¿Semaphore

ÐźÅÁ¿Êǽ¨Á¢ÔÚ»¥³âÁ¿µÄ»ù´¡Ö®ÉÏ£¬Í¬Ê±¼ÓÈëÖØÒªÌØÐÔ£ºÌṩÁË×ÊÔ´¼ÆÊý¹¦ÄÜ£¬Òò´ËÔ¤¶¨ÒåÊýÁ¿µÄÏß³Ìͬʱ¿ÉÒÔ½øÈëͬ²½µÄ´úÂë¿éÖС£
      ÐźÅÁ¿ÊÇά»¤0µ½Ö¸¶¨×î´óÖµÖ®¼äµÄ¼ÆÊýÆ÷µÄͬ²½¶ÔÏ󣬵±Ïß³ÌÍê³ÉÒ»´ÎÐźÅÁ¿µÄµÈ´ýʱ£¬¼ÆÊýÆ÷×Ô¼õ1£¬µ±Ïß³ÌÊÍ·ÅÐźÅÁ¿¶ÔÏóʱ£¬¼ÆÊýÆ÷×ÔÔö1¡£
      ½èÓÃÉÏÃæµÄͼÊé¹ÝÀý×Ó£¬ÐźÅÁ¿ºÃÏñÊǶàÉ輸°Ñ¹ÜÀíÔ¿³×¡£Ã¿´Î¿ÉÒÔÉ趨N°ÑÔ¿³×ͬʱ¹¤×÷£¬ÄǾÍÓÐN¸öÈËÔ±¿ÉÒÔͬʱ°ìÀíÒµÎñ¡£
     ÐźÅÁ¿Ê¹ÓõÄÒ»°ã²½Ö裺
1¡¢ÉùÃ÷Ò»¸öÈ«¾ÖµÄÐźÅÁ¿Ãû±ú£¬È磺hSem:THandle;
2¡¢´´½¨ÐźÅÁ¿£ºCreateSemphore(
                              lpSemaphoreAttributes:PSecurityAttributes;
                              lInitialCount,lMaximumCount:LongInt;
                              lpName:PChar):THandle;stdcall;
  £¨lpSemaphoreAttributes²ÎÊý£¬Ö¸ÏòTSecurityAttributes¼Ç¼µÄÖ¸Õ룬һ°ã¿ÉÒÔȱʡÌîÈënilÖµ£»
    lInitialCount²ÎÊý£¬ÊÇÐźÅÁ¿¶ÔÏóµÄ³õʼ¼ÆÊý£¬ÊÇ0~lMaximumCountÖ®¼äµÄÊý¡£µ±Ëü´óÓÚ0ʱ£¬ÐźÅÁ¿¾Í½øÈëÁËÐźÅ״̬£¬µ±WaiForSingleObjectº¯ÊýÊÍ·ÅÁËÒ»¸öỊ̈߳¬ÐźÅÁ¿¼ÆÊý¾Í¼õ1¡£Ê¹ÓÃReleaseSemphoreº¯Êý¿ÉÒÔÔö¼ÓÐźÅÁ¿¼ÆÊý£»
   lMaximumCount²ÎÊý£¬ÊÇÐźÅÁ¿¶ÔÏó¼ÆÊýµÄ×î´óÖµ£»
   lpName²ÎÊý£¬Ö¸¶¨ÐźÅÁ¿µÄÃû×Ö¡££©
3¡¢Óõȴýº¯ÊýWaiForSingleObjectЭµ÷Ï̡߳£
4¡¢µ±Ò»¸öÏß³ÌÓÃÍêÒ»¸öÐźţ¬ÊÍ·Å¡£Ê¹ÓÃReleaseSemphore(
                                              


Ïà¹ØÎĵµ£º

delphi ¿ì½Ý¼üµÄʹÓÃ

CTRL+SPACE ´úÂ벹ȫ£¬ºÜºÃÓõÄ(ÏȸÄÁËÊäÈë·¨Èȼü)
CTRL+SHIFT+C ±àдÉêÃ÷»òÕß²¹ÉϺ¯Êý
CTRL+SHIFT+↑(↓) ÔÚ¹ý³Ì¡¢º¯Êý¡¢Ê¼þÄÚ²¿, ¿ÉÌøÔ¾µ½ÏàÓ¦µÄ¹ý³Ì¡¢º¯Êý¡¢Ê¼þµÄ¶¨Ò壨ÔÚINTERFACEºÍIMPLEMENTATIONÖ®¼äÀ´»ØÇл»£©
CTRL+SHIFT+G ²åÈëGUID
CTRL+J (µ¯³öDELPHIÓï¾äÌáʾ´°¿Ú£¬Ñ¡ÔñËùÐèÓï¾ä½«×Ô¶¯Íê³ÉÒ»Ìõ ......

delphiʵÏÖÅúÁ¿¶ÁÈ¡¸ñʽÓйæÂɵÄÎı¾ÎļþµÄÄÚÈÝ.

ÏÖÓÐһϵͳ²»¶¨Ê±ÔÚͬһĿ¼ÏÂÉú³ÉÒ»ÅútxtÎļþ,ÄÚÈÝ´ó¸ÅÈçÏÂ;
      20100112_164910,6,81406392,808,113,,
Ϊ·½±ãͳ¼Æ,ÐèÒª½«ÕâЩtxtÎļþÖеÄÊý¾Ý¶ÁÈëÊý¾Ý±íÖÐ.
ÏÖÓÐÁ½ÖÖ·½·¨:
   Ò»ÊÇÖ±½Ó½«Êý¾Ý¶ÁÈëµ½Êý¾Ý±íÖеÄijһÁÐÖÐ,ÔÙÓÃsql Óï¾ä²ð¿ª³É¼¸ÁÐ: 
     ......

Óô½ðÏãdelphiÍâ¹Ò±à³Ì(·­Â¼°æ) ÖÖ×Ó·¢²¼

http://www.91v1.cn/bbs/read.php?tid-1797.html
ÎÒÃÇÌṩµÄÊÇÈ«Ì×,Ä¿Ç°ËûÃÇ·¢µÄ.ÉçÇøÒѼÖÆÍê±Ï.Ò»¸ùë²»ÉÙ.
-------------------------------------------------------------------------------------------------------------------------
¸Ã½Ì³ÌÓÉ91v1ÉçÇøÃâ·ÑÌṩ.¾ßÌåÃâ·ÑÁìÂëÏêÇé¹Û¿´ÖÖ×Ó°ü,
--------------- ......

Delphi¶àÏß³Ìѧϰ£¨3£©£ºÏß³Ìͬ²½µÄÔ­Òò

ÔÚʹÓöàÏ̵߳Äʱºò£¬Èç¹û¶àÏ̶߳Ôij¸öÌض¨µÄ¹«¹²Êý¾Ý»ò×ÊÔ´½øÐзÃÎÊ£¬ÐèÒª¶Ô¶àÏ߳̽øÐÐЭµ÷²Ù×÷£¬½Ð×öÏß³Ìͬ²½¡£
     ÀýÈ磺Èý¸öÏ̷ֱ߳ðÑ­»·µØÏòListBoxÖÐдÈëÊý¾Ý¡£Ã»ÓнøÐÐͬ²½Ê±£¬Ð´ÈëµÄ˳ÐòÊDz»È·¶¨µÄ¡£
{Ö÷´°Ìå´úÂë}
unit Unit2;

interface

uses
Windows, Messages, SysUtils, V ......

Delphi¶àÏß³Ìѧϰ£¨5£©£º»¥³âÁ¿Mutex

»¥³âÁ¿ÊÇϵͳÄں˶ÔÏó£¬Ë­ÓµÓоÍË­Ö´ÐС£ËüÓëÁÙ½çÇø¹¤×÷ºÜÀàËÆ¡£²»Í¬´¦ÔÚÓÚ£º1¡¢»¥³âÁ¿¿ÉÒÔ¿ç½ø³Ì±ß½çͬ²½Ï̡߳£2¡¢¿ÉÒÔ¸ø»¥³âÁ¿È¡¸öÃû×Ö£¬Í¨¹ýÒýÓû¥³âÁ¿µÄÃû×ÖÀ´Ê¹ÓÃÒ»¸öÒÑÖªµÄ»¥³âÁ¿¶ÔÏó¡£
     ʹÓû¥³âÁ¿Ö®ÀàµÄ¶ÔÏóÐèÒª·´¸´µ÷ÓÃϵͳÄںˣ¬ÆÚ¼äÐèÒª½øÐнø³ÌÉÏÏÂÎÄת»»ºÍ¿ØÖƼ¶±ðת»»£¬´ó¸ÅÐèÒªºÄ· ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ