- UID
- 213575
- 帖子
- 228
- 主題
- 21
- 精華
- 0
- 積分
- 511
- 楓幣
- 636
- 威望
- 504
- 存款
- 0
- 贊助金額
- 0
- 推廣
- 0
- GP
- 93
- 閱讀權限
- 50
- 性別
- 女
- 在線時間
- 130 小時
- 註冊時間
- 2017-11-24
- 最後登入
- 2024-12-6
|
0720 發表於 2018-6-15 09:43
有語法嗎~
Private Declare Function CreateMutex Lib "kernel32" Alias "CreateMutexA" (lpMutexAttributes As SECURITY_ATTRIBUTES, ByVal bInitialOwner As Long, ByVal lpName As String) As Long
Private Type SECURITY_ATTRIBUTES
nLength As Long
lpSecurityDescriptor As Long
bInheritHandle As Long
End Type
Private Const ERROR_ALREADY_EXISTS = 183&
Private Sub Form_Load()
Dim sa As SECURITY_ATTRIBUTES
sa.bInheritHandle = 1
sa.lpSecurityDescriptor = 0
sa.nLength = Len(sa)
Call CreateMutex(sa, 1, App.Title)
If (Err.LastDllError = ERROR_ALREADY_EXISTS) Then
MsgBox "請勿重復運行", , ""
End
End If
End Sub
VB6防多開的寫法 |
|