ฟังก์ชั่นนี้สำหรับ PB8, Win2000 นะครับ สำหรับ เวอร์ชั่นอื่นนี่ไม่ได้ทดสอบครับ:
ทำการกำหนด global external functions:(ตัวเล็กตัวใหญ่มีผลนะครับ)
function ulong CreateMutexA (ulong lpMutexAttributes, boolean bInitialOwner, ref string lpName) library "kernel32.dll" function ulong GetLastError () library "kernel32.dll" function ulong CloseHandle(ulong hMutex) library "kernel32.dll"
string ls_Name
uint lui_rc2
boolean lb_inherit
// Determine if this application is already running. If so, HALT this instance. lb_inherit=false ls_Name="YourApp" g_mutex_handle=CreateMutexA(0, lb_inherit, ls_Name)
lui_rc2=getlasterror()
// If mutex already exists, this application is already running, so close
if lui_rc2=183 then
CloseHandle(g_mutex_handle)
// MessageBox("Your App Name Here", "This application is already running. You " +& // "cannot start it again") HALT end if
ลองใช้งานดูนะครับ ไปเจอเข้าน่ะครับ เหมาะสำหรับการป้องกันการ รัน application ซ้ำซ้อนในเครื่องเดียวกันน่ะครับ
บทความนี้มาจาก www.soopawat.com
ฟังก์ชั่นสำหรับ PB8, Win2000 นะครับ สำหรับ เวอร์ชั่นอื่นนี่ไม่ได้ทดสอบครับ
Latest News
- บทที่ 7-1 ตอน การสร้างระบบฐานข้อมูล
- บทที่ 6 ทดลองเขียนโปรแกรมด้วย PocketBuilder เบื้องต้น
- บทที่ 4 ติดตั้งdatabase sql anywhere
- บทที่ 7-2 ตอน การสร้างโปรแกรมแสดงรายการอาหารที่สั่ง ด้วย Powerbuilder 9
- บทที่ 3 ติดตั้งอุปกรณ์ และโปรแกรม Active Sync
- ทำชุด setup โปรแกรมด้วย Wise Install
- การติดตั้ง IIS
- ตัวอย่าง code โปรแกรมร้านเช่า VDO
- สมาชิก : 2
- Content : 336
- เว็บลิงก์ : 8
- จำนวนครั้งเปิดดูบทความ : 159050


