유돌이

calendar

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

Notice

2009. 6. 26. 14:03 델파이

프로그램이 이미 실행된 상태에서
동일한 프로그램이 중복 실행되는 것을 방지하려면

프로젝트 소스 파일에서 다음과 같이 코딩합니다.

program Project;

uses
Forms,windows,
Unit1 in 'Unit1.pas' {Form1};

var
Mutex : THandle;

{$R *.RES}

begin
  Mutex := CreateMutex(nil, True, 'noDuplicate');
  if (Mutex <> 0 ) and (GetLastError = 0) then

  begin
    Application.Initialize;
    Application.CreateForm(TForm1, Form1);
    Application.Run;
   

    if Mutex <> 0 then CloseHandle(Mutex);
  end;
end.


'델파이' 카테고리의 다른 글

한영 변환 방법  (0) 2010.01.11
Grid에 CheckBox 넣기  (0) 2010.01.11
Caps Lock 체크 하는 방법  (0) 2009.06.26
현재 날짜 구하는 함수  (0) 2009.06.26
델파이 단축키  (0) 2009.06.26
posted by 유돌이