{"rsdb":{"rid":"352297","subhead":"","postdate":"0","aid":"250026","fid":"86","uid":"1","topic":"1","content":"
\n

\u4f7f\u7528CreateMutex\u51fd\u6570\u521b\u5efa\u4e92\u65a5\u5bf9\u8c61<\/strong><\/p> \n

\u5229\u7528Windows\u7cfb\u7edf\u51fd\u6570CreateMutex()\uff0c\u627e\u51fa\u5f53\u524d\u7cfb\u7edf\u662f\u5426\u5df2\u7ecf\u5b58\u5728\u6307\u5b9a\u8fdb\u7a0b\u7684\u5b9e\u4f8b\uff0c\u5982\u679c\u6ca1\u6709\u5219\u521b\u5efa\u4e00\u4e2a\u4e92\u65a5\u4f53\u3002<\/p> \n

CreateMutex\u51fd\u6570\u539f\u578b\u5982\u4e0b:<\/p> \n

function CreateMutex(lpMutexAttributes: PSecurityAttributes; bInitialOwner: BOOL; lpName: PChar): THandle; <\/p> \n

\u5176\u4e2d\u53c2\u6570\uff1a<\/p> \n

lpMutexAttributes \uff1aSECURITY_ATTRIBUTES \u7ed3\u6784\u7c7b\u578b\u6307\u9488\uff0c\u53ef\u4ee5\u4e3aNULL\u3002<\/p> \n

bInitialOwner \uff1a\u662f\u5426\u521d\u59cb\u5316\u4e92\u65a5\u4f53\u3002<\/p> \n

lpName \uff1a\u4e92\u65a5\u4f53\u5bf9\u8c61\u7684\u540d\u79f0\uff0c\u4e00\u822c\u662f\u5de5\u7a0b\u7684\u540d\u79f0\u3002<\/p> \n

\u6700\u7ec8\uff0c\u51fd\u6570\u8fd4\u56de\u4e00\u4e2a\u4e92\u65a5\u4f53\u53e5\u67c4\u3002<\/p> \n

 <\/p> \n

Delphi WinFrm\u5229\u7528\u4e92\u65a5\u5bf9\u8c61\u5b9e\u73b0\u5355\u4f8b\u6a21\u5f0f<\/strong><\/p> \n

\u5355\u51fbProject\uff0cView Source\uff1b<\/p> \n

uses \u4e2d\u6dfb\u52a0Windows\uff1b<\/p> \n

Begin\u548cEnd\u4e4b\u95f4\u6dfb\u52a0\u5982\u4e0b\u4ee3\u7801\u3002<\/p> \n

\"\"\"\"<\/p> \n

 <\/p> \n

 <\/p> \n

\n
  \/\/<\/span>*****************************\u5355\u4f8b\u6a21\u5f0f********************************<\/span>\r\n  CreateMutex(nil<\/span>, False, '<\/span>Application Name<\/span>'<\/span>);\r\n  <\/span>if<\/span> GetLastError = ERROR_ALREADY_EXISTS then<\/span>\r\n  begin<\/span>\r\n    Application.MessageBox(<\/span>'<\/span>\u7cfb\u7edf\u5df2\u7ecf\u5f00\u542f\u4e86\uff0c\u8bf7\u786e\u8ba4\u4e0b\uff01<\/span>'<\/span>, '<\/span>\u63d0\u793a<\/span>'<\/span>, MB_OK);\r\n    Halt(<\/span>0<\/span>);\r\n  <\/span>end<\/span>;\r\n    <\/span>\/\/<\/span>*****************************\u5355\u4f8b\u6a21\u5f0f********************************<\/span><\/pre> \n <\/div> \n 

 <\/p> \n<\/div>","orderid":"0","title":"Delphi - \u4e92\u65a5\u5bf9\u8c61\u4e0b\u5b9e\u73b0\u7cfb\u7edf\u7684\u5355\u4f8b\u6a21\u5f0f","smalltitle":"","mid":"0","fname":"Delphi","special_id":"0","bak_id":"0","info":"0","hits":"254","pages":"1","comments":"0","posttime":"2019-09-04 00:59:56","list":"1567529996","username":"admin","author":"","copyfrom":"","copyfromurl":"","titlecolor":"","fonttype":"0","titleicon":"0","picurl":"https:\/\/www.cppentry.com\/upload_files\/","ispic":"0","yz":"1","yzer":"","yztime":"0","levels":"0","levelstime":"0","keywords":"Delphi<\/A> \u5bf9\u8c61<\/A> \u5b9e\u73b0<\/A> \u7cfb\u7edf<\/A> \u5355\u4f8b<\/A> \u6a21\u5f0f<\/A>","jumpurl":"","iframeurl":"","style":"","template":"a:3:{s:4:\"head\";s:0:\"\";s:4:\"foot\";s:0:\"\";s:8:\"bencandy\";s:0:\"\";}","target":"0","ip":"120.229.33.222","lastfid":"0","money":"0","buyuser":"","passwd":"","allowdown":"","allowview":"","editer":"","edittime":"0","begintime":"0","endtime":"0","description":"Delphi - \u4e92\u65a5\u5bf9\u8c61\u4e0b\u5b9e\u73b0\u7cfb\u7edf\u7684\u5355\u4f8b\u6a21\u5f0f","lastview":"1714082800","digg_num":"0","digg_time":"0","forbidcomment":"0","ifvote":"0","heart":"","htmlname":"","city_id":"0"},"page":"1"}