Notice
Recent Posts
Recent Comments
관리 메뉴

안까먹을라고 쓰는 블로그

[C#] 프로그램 중복실행 방지 본문

Language/C#

[C#] 프로그램 중복실행 방지

YawnsDuzin 2012. 12. 11. 18:13

 

반응형


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System.Threading;
 
/// 
 
/// 프로그램 중복실행 체크
/// 
/// 중복실행 체크할 프로그램이름
/// true - 실행안됨 / false - 실행중
public bool IsProgramExcute(string ProgName)
{
    bool IsExcute;
    Mutex mutext = new Mutex(true, ProgName, out IsExcute);
 
    if (IsExcute) return true;      // 실행안됨
    else return false;              // 실행중
}
 
 
/// 
 
/// Form Load Function
/// 
/// 
/// 
private void frmDolphineReport_Load(object sender, EventArgs e)
{
    if (CM.IsProgramExcute("Report_Program"== false)
    {
        MessageBox.Show("프로그램이 이미 실행중입니다!");
        this.Close();
    }
    else
    {
    }
}
cs


반응형

'Language > C#' 카테고리의 다른 글

[C#] 비동기 통신관련 공부할것  (0) 2013.04.29
[C#] delegate / Event / Thread  (0) 2012.12.26
[C#] INI 읽고/쓰기  (0) 2012.12.10
[C#] 부모폼과 자식폼의 참조  (0) 2012.10.30
[C#] IPC / RPC 통신  (0) 2012.10.29
Comments