- UID
- 213575
- 帖子
- 227
- 主題
- 20
- 精華
- 0
- 積分
- 509
- 楓幣
- 600
- 威望
- 503
- 存款
- 0
- 贊助金額
- 0
- 推廣
- 0
- GP
- 92
- 閱讀權限
- 50
- 性別
- 女
- 在線時間
- 127 小時
- 註冊時間
- 2017-11-24
- 最後登入
- 2024-11-17
|
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防多開的寫法 |
|