计算机工程与设计
計算機工程與設計
계산궤공정여설계
COMPUTER ENGINEERING AND DESIGN
2010年
9期
2151-2154
,共4页
程序实例%软件系统%线程互斥体%全局原子%窗口句柄%进程ID
程序實例%軟件繫統%線程互斥體%全跼原子%窗口句柄%進程ID
정서실례%연건계통%선정호척체%전국원자%창구구병%진정ID
instance of application%software system%thread mutex%global atom%window handle%process ID
目前在Windows操作系统下,实现只运行一份程序实例的常用方法都在可靠性方面存在着严重缺陷的问题,系统地介绍了"查找程序主窗口标题"、"使用线程互斥体"和"使用Windows全局原子"3种方法的实现原理,分析了3种方法各自的优缺点.在此基础上,提出了通过主窗口句柄与进程ID相互配合实现只运行一份程序实例的方法,运行结果表明了该方法的简易性和可靠性.
目前在Windows操作繫統下,實現隻運行一份程序實例的常用方法都在可靠性方麵存在著嚴重缺陷的問題,繫統地介紹瞭"查找程序主窗口標題"、"使用線程互斥體"和"使用Windows全跼原子"3種方法的實現原理,分析瞭3種方法各自的優缺點.在此基礎上,提齣瞭通過主窗口句柄與進程ID相互配閤實現隻運行一份程序實例的方法,運行結果錶明瞭該方法的簡易性和可靠性.
목전재Windows조작계통하,실현지운행일빈정서실례적상용방법도재가고성방면존재착엄중결함적문제,계통지개소료"사조정서주창구표제"、"사용선정호척체"화"사용Windows전국원자"3충방법적실현원리,분석료3충방법각자적우결점.재차기출상,제출료통과주창구구병여진정ID상호배합실현지운행일빈정서실례적방법,운행결과표명료해방법적간역성화가고성.
Aiming at the problems that the methods to accomplish running a single instance of application on Windows OS have serious imperfection of reliability at present,three methods,including"Looking up the caption of the main window of the application","Using thread mutex"and"Using Windows global atom",are introduced systematically.The advantages and disadvantages of the methods are analyzed.Based on the introduction and analysis,a more simple and reliable method that to accomplish running a single instance of application through cooperation of main window handle and thread ID is put forward and demonstrated.