function ulong CreateMutexA (ulong lpMutexAttributes,int bInitialOwner,ref string lpName) library "kernel32.dll"
function ulong GetLastError () library "kernel32.dll"
// 어플리케이션 Open Event 스크립트
ulong ll_mutex, ll_err
string ls_mutex_name
if handle (GetApplication (), false) <> 0 then
ls_mutex_name = this.AppName + char (0)
// Create the mutex. Since we're not going to do anything with
// it, ignore the first two arguments
ll_mutex = CreateMutexA (0, 0, ls_mutex_name)
ll_err = GetLastError ()
if ll_err = 183 then // Is running
MessageBox ("Error", "Application already running.")
halt close
else
// Not running
end if
else
// We're in the development environment.
// If you go ahead and create the mutex here, be sure to destroy it
// in the application close event, or bad things will happen.
end if
찾고보니 간단하구만....-_-;;
DB에 상태값을 넣어두는것은 오류 종료시 문제가 있고,
FindWindowsA로 타이틀명을 가지고 오는것도 조금은 문제가 있는데,
이것이 제일 깔끔한듯....
double.pbl파워빌더 6.5용 샘플소스